Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- bannerList = [[NSMutableArray alloc] init];
- bannerList = [WebFunctions fetchBannerDataHavingUrl:@"banners/event"];
- NSTimer* timer = [NSTimer timerWithTimeInterval:3.0f target:self selector:@selector(updateLabel) userInfo:nil repeats:YES];
- [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
- }
- - (void)updateLabel {
- BannerDC *bannerObj = [[BannerDC alloc] init];
- if (count == bannerList.count){
- count = 0;
- } else {
- bannerObj = [bannerList objectAtIndex:count];
- lblFeaturedEventTitle.text = bannerObj.line1;
- imgFeaturedEventImage.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:bannerObj.img_url]]];
- // get the view that's currently showing
- [self.viewBannersBackground removeFromSuperview];
- [self.viewBanners addSubview:self.viewBannersBackground];
- // set up an animation for the transition between the views
- CATransition *animation = [CATransition animation];
- [animation setDuration:1.0];
- [animation setType:kCATransitionPush];
- [animation setSubtype:kCATransitionFromRight];
- [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
- [[self.viewBannersBackground layer] addAnimation:animation forKey:@"SwitchToView1"];
- count++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement