Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. - (void)viewDidLoad
  2. {
  3. [super viewDidLoad];
  4. bannerList = [[NSMutableArray alloc] init];
  5. bannerList = [WebFunctions fetchBannerDataHavingUrl:@"banners/event"];
  6.  
  7. NSTimer* timer = [NSTimer timerWithTimeInterval:3.0f target:self selector:@selector(updateLabel) userInfo:nil repeats:YES];
  8. [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
  9. }
  10.  
  11. - (void)updateLabel {
  12.  
  13. BannerDC *bannerObj = [[BannerDC alloc] init];
  14. if (count == bannerList.count){
  15. count = 0;
  16. } else {
  17. bannerObj = [bannerList objectAtIndex:count];
  18.  
  19. lblFeaturedEventTitle.text = bannerObj.line1;
  20. imgFeaturedEventImage.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:bannerObj.img_url]]];
  21.  
  22. // get the view that's currently showing
  23. [self.viewBannersBackground removeFromSuperview];
  24. [self.viewBanners addSubview:self.viewBannersBackground];
  25.  
  26. // set up an animation for the transition between the views
  27. CATransition *animation = [CATransition animation];
  28. [animation setDuration:1.0];
  29. [animation setType:kCATransitionPush];
  30. [animation setSubtype:kCATransitionFromRight];
  31. [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
  32.  
  33. [[self.viewBannersBackground layer] addAnimation:animation forKey:@"SwitchToView1"];
  34.  
  35. count++;
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement