EGOTableViewPullRefresh 是fork EGOTableViewPullRefresh開源類庫進行的改進,添加了上提加載更多效果。同時也可以通過一個按鈕的觸發(fā)刷新事件,但是刷新的時候不能跳到top,為了動態(tài)展示,再刷新的時候按鈕旋轉(zhuǎn),然后跳轉(zhuǎn)回到頂部!如下如圖
成都創(chuàng)新互聯(lián)公司技術(shù)團隊十載來致力于為客戶提供網(wǎng)站設(shè)計、網(wǎng)站建設(shè)、高端網(wǎng)站設(shè)計、成都營銷網(wǎng)站建設(shè)、搜索引擎SEO優(yōu)化等服務(wù)。經(jīng)過多年發(fā)展,公司擁有經(jīng)驗豐富的技術(shù)團隊,先后服務(wù)、推廣了1000+網(wǎng)站,包括各類中小企業(yè)、企事單位、高校等機構(gòu)單位。關(guān)于EGOTableViewPullRefresh可以參照http://blog.csdn.net/duxinfeng2010/article/details/9007311,翻譯過的用法,在這個Demo基礎(chǔ)上進行修改,點擊Demo下載;
1、給工程添加一個導(dǎo)航欄,在application: didFinishLaunchingWithOptions:方法中
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. // [[UINavigationBar appearance] setBackgroundImage:[UIImage p_w_picpathNamed:@"navbar.png"] forBarMetrics:UIBarMetricsDefault]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:self.viewController]; self.window.rootViewController = nav; [self.window makeKeyAndVisible]; return YES; }
2、在ViewDidLoad方法中,修改背景圖片,添加刷新按鈕
- (void)viewDidLoad { [super viewDidLoad]; self.navigationController.navigationBar.tintColor = [UIColor colorWithPatternImage:[UIImage p_w_picpathNamed:@"navbar.png"]]; self.pullTableView.pullArrowImage = [UIImage p_w_picpathNamed:@"blackArrow"]; // self.pullTableView.pullBackgroundColor = [UIColor yellowColor]; self.pullTableView.pullTextColor = [UIColor blackColor]; CGRect rect = CGRectMake(0, 0, 44, 44); UIButton *refreshBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; refreshBtn.frame = rect; [refreshBtn setBackgroundImage:[UIImage p_w_picpathNamed:@"button_refresh"] forState:UIControlStateNormal]; [refreshBtn addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *refreshItem = [[UIBarButtonItem alloc] initWithCustomView:refreshBtn]; self.navigationItem.leftBarButtonItem = refreshItem; }