Download code
首先import這class
#import "ImageSwitcher.h"
接著在需要的地方init出來,請記得使用initWithFrame,因為我也只有寫在這裡...反正順便設定寬高大小,以下為加入ViewController內
ImageSwitcher *imgSwitcher = [[ImageSwitcher alloc] initWithFrame:CGRectMake(0, 100, self.view.frame.size.width, 60)];
[self.view addSubview:imgSwitcher];
[imgSwitcher release];
完畢
※圖片檔我預設為"ad%d.png",例ad1.png,圖片都是放local端,等哪天有空再把直接web下載+lazyload加進來
※adHeight為廣告高度
※switchADTime為切換時間的長短
Download code
相關連結
iOS Developer Library
iOS Developer Library - UIImageView
iOS Developer Library - UIScrollView