ios - Change UILabel Text for a specific time period on a specific day -


first of let me apologize asking question no doubt boring 99% of people see it. have searched , come across different ideas can't seem head round implementing them.

basically want have uilabel says example "this test" other 2 hours, between 4 , 6pm on friday "this not test" , 6:01pm revert saying "this test" , repeat every friday.

i using marqueelabel subclass of uilabel, being done through interface builder , below code in viewdidload.

self.scrollinglabel.marqueetype = mlcontinuous;  self.scrollinglabel.scrollduration = 40.0f;  self.scrollinglabel.fadelength = 10.0f;  self.scrollinglabel.text = @"this test";  self.scrollinglabel.userinteractionenabled = yes; uitapgesturerecognizer *taprecognizer = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(pausetap:)];  taprecognizer.numberoftapsrequired = 1;  taprecognizer.numberoftouchesrequired = 1;  [self.scrollinglabel addgesturerecognizer:taprecognizer];  self.scrollinglabel.layer.shadowcolor = [uicolor blackcolor].cgcolor;  self.scrollinglabel.layer.shadowoffset = cgsizemake(1.0f,1.0f);  self.scrollinglabel.layer.maskstobounds = no;  self.scrollinglabel.layer.shadowradius = 1.5f;  self.scrollinglabel.layer.shadowopacity = 0.6; 

again apologies if makes no sense new xcode , first question on stack overflow.

anything points me in right direction appreciated.

[nstimer scheduledtimerwithtimeinterval:1.0     target:self     selector:@selector(targetmethod)     userinfo:nil     repeats:no]; put line `viewdidload` method    ,  -(void)targetmethod{         nsdateformatter *formatter = [[nsdateformatter alloc] init]; [formatter setdateformat:@"eee hh mm"];  nsdate *dt = [nsdate date];  nsstring *dayastring = [formatter stringfromdate:dt];  nsarray *array = [dayastring componentsseparatedbystring: @" "];  if([[array objectatindex:0] isequaltostring:@"friday"] && [[array objectatindex:1] intvalue]>=4 &&  [[array objectatindex:1] intvalue]<=6 && [[array objectatindex:2] intvalue]>=0 && [[array objectatindex:2] intvalue]<=59)        {                self.scrollinglabel.text=@"this not test";                  nslog(@"on air");        }        else{                self.scrollinglabel.text=@"this test";                   nslog(@"off air");        } } 

Comments