关于下拉更新框架 EGORefreshTableHeaderView在Xcode4.2中, ARC
关于如何在页面中使用EGORefreshTableHeaderView的文章网上一大把, 抄来抄去的, 但也都没什么大问题. 只是在XCode4.2的ARC环境中使用的时候, 错误一把. 借此机会, 完整的记录一下如何排除错误, 及使用的方法. 首先第一步当然是下载这个下拉更新的框架了. htt
关于如何在页面中使用EGORefreshTableHeaderView的文章网上一大把, 抄来抄去的, 但也都没什么大问题. 只是在XCode4.2的ARC环境中使用的时候, 错误一把. 借此机会, 完整的记录一下如何排除错误, 及使用的方法.
首先第一步当然是下载这个下拉更新的框架了. https://github.com/enormego/EGOTableViewPullRefresh/downloads
下载之后解包, 然后将
EGORefreshTableHeaderDelegate.h
EGORefreshTableHeaderDelegate.m
这两个文件, 以及项目中的图片文件都复制到你的项目文件内, 这时候, 如果你启用了ARC, 应该会报一片错误, 让我们来具体看一下.
启用了ARC之后, 就不允许手动的release了, 因此, [view release], [lable release] 还有 autorelease这样的代码都需要删除掉.
在EGORefreshTableHeaderDelegate.m的这个文件中, @synthesize delegate=_delegate; 会报错, "
解决办法是需要将EGORefreshTableHeaderDelegate.h文件中的 assign 换为retain
//@property(nonatomic,assign) id <egorefreshtableheaderdelegate> delegate; //删除掉. 换为下面的 @property(nonatomic,retain)id <egorefreshtableheaderdelegate> delegate;</egorefreshtableheaderdelegate></egorefreshtableheaderdelegate>
这样代码就会通过编译了~ 这样就需要将EGORefreshTableHeaderView与我们的tableview整合了, 然后按照Demo的方法,
添加EGORefreshTableHeaderDelegate的接口,
定义_reloading, 和EGORefreshHeaderView
声明reloadTableViewDataSource和doneLoadingTableView这两个函数
#import <uikit> #import "EGORefreshTableHeaderView.h" @interface FMFutureMessage : UIViewController<uitableviewdelegate uitableviewdatasource> { BOOL _reloading; EGORefreshTableHeaderView *_refreshHeaderView; } @property(strong, nonatomic) IBOutlet UITableView *tbView; -(void)reloadTableViewDataSource; -(void)doneLoadingTableViewData; @end</uitableviewdelegate></uikit>
接下来, 我们需要将xib文件中的TableViewController与这里定义的tbView建立关联, 因为我忘记了指定tbView与XIB中的TabViewController, 导致了刷新箭头怎么样也显示不出来, 所以一定不要忘记啊~~~~
现在我们处理一下.m文件
处理m文件, 建立关联.和响应事件.
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. if(_refreshHeaderView == nil) { EGORefreshTableHeaderView *view = [[EGORefreshTableHeaderView alloc] initWithFrame:CGRectMake(0.0f, 0.0f - self.tbView.bounds.size.height, self.view.frame.size.width, self.tbView.bounds.size.height)]; view.delegate = self; [self.tbView addSubview:view]; _refreshHeaderView = view; } [_refreshHeaderView refreshLastUpdatedDate]; }
-(void)reloadTableViewDataSource { NSLog(@"==开始加载数据"); [self.tbView reloadData]; _reloading = YES; } - (void)doneLoadingTableViewData{ NSLog(@"===加载完数据"); // model should call this when its done loading _reloading = NO; [_refreshHeaderView egoRefreshScrollViewDataSourceDidFinishedLoading:self.tbView]; } #pragma mark – #pragma mark UIScrollViewDelegate Methods - (void)scrollViewDidScroll:(UIScrollView *)scrollView{ [_refreshHeaderView egoRefreshScrollViewDidScroll:scrollView]; } - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{ [_refreshHeaderView egoRefreshScrollViewDidEndDragging:scrollView]; } #pragma mark – #pragma mark EGORefreshTableHeaderDelegate Methods - (void)egoRefreshTableHeaderDidTriggerRefresh:(EGORefreshTableHeaderView*)view{ [self reloadTableViewDataSource]; [self performSelector:@selector(doneLoadingTableViewData) withObject:nil afterDelay:3.0]; } - (BOOL)egoRefreshTableHeaderDataSourceIsLoading:(EGORefreshTableHeaderView*)view{ return _reloading; // should return if data source model is reloading } - (NSDate*)egoRefreshTableHeaderDataSourceLastUpdated:(EGORefreshTableHeaderView*)view{ return [NSDate date]; // should return date data source was last changed }
最后, 如果是开发中文应用程序, 不要忘记进入EGORefreshTableHeaderView.m中, 将提示的英文换成中文.
好了, 完成~~~

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



A friend's computer has such a fault. When opening "This PC" and the C drive file, it will prompt "Explorer.EXE Windows cannot access the specified device, path or file. You may not have the appropriate permissions to access the project." Including folders, files, This computer, Recycle Bin, etc., double-clicking will pop up such a window, and right-clicking to open it is normal. This is caused by a system update. If you also encounter this situation, the editor below will teach you how to solve it. 1. Open the registry editor Win+R and enter regedit, or right-click the start menu to run and enter regedit; 2. Locate the registry "Computer\HKEY_CLASSES_ROOT\PackagedCom\ClassInd"

Windows updates may cause some of the following problems: 1. Compatibility issues: Some applications, drivers, or hardware devices may be incompatible with new Windows updates, causing them to not work properly or crash. 2. Performance issues: Sometimes, Windows updates may cause the system to become slower or experience performance degradation. This may be due to new features or improvements requiring more resources to run. 3. System stability issues: Some users reported that after installing Windows updates, the system may experience unexpected crashes or blue screen errors. 4. Data loss: In rare cases, Windows updates may cause data loss or file corruption. This is why before making any important updates, back up your

Evaluating the cost/performance of commercial support for a Java framework involves the following steps: Determine the required level of assurance and service level agreement (SLA) guarantees. The experience and expertise of the research support team. Consider additional services such as upgrades, troubleshooting, and performance optimization. Weigh business support costs against risk mitigation and increased efficiency.

The lightweight PHP framework improves application performance through small size and low resource consumption. Its features include: small size, fast startup, low memory usage, improved response speed and throughput, and reduced resource consumption. Practical case: SlimFramework creates REST API, only 500KB, high responsiveness and high throughput

The learning curve of a PHP framework depends on language proficiency, framework complexity, documentation quality, and community support. The learning curve of PHP frameworks is higher when compared to Python frameworks and lower when compared to Ruby frameworks. Compared to Java frameworks, PHP frameworks have a moderate learning curve but a shorter time to get started.

Choose the best Go framework based on application scenarios: consider application type, language features, performance requirements, and ecosystem. Common Go frameworks: Gin (Web application), Echo (Web service), Fiber (high throughput), gorm (ORM), fasthttp (speed). Practical case: building REST API (Fiber) and interacting with the database (gorm). Choose a framework: choose fasthttp for key performance, Gin/Echo for flexible web applications, and gorm for database interaction.

Browser updates and upgrades are not uncommon, and some of the problems we encounter online may be caused by the system not being updated in time. Stable updates can ensure normal use of the browser, and we can better use the functions inside and maximize the performance of the browser. So how to update Google Chrome? This site brings you how to update Google Chrome to solve everyone's difficulties. The first step to update Google Chrome: Open the Chrome browser and click the [three dots] in the upper right corner. (As shown in the picture) Step 2: Click [Settings] in the menu drop-down to enter. (As shown in the picture) Step 3: Find [About Chrome] on the right and click to enter. (As shown in the picture) Step 4: Chrome browser will automatically check and install updates. (As shown in the picture

In Go framework development, common challenges and their solutions are: Error handling: Use the errors package for management, and use middleware to centrally handle errors. Authentication and authorization: Integrate third-party libraries and create custom middleware to check credentials. Concurrency processing: Use goroutines, mutexes, and channels to control resource access. Unit testing: Use gotest packages, mocks, and stubs for isolation, and code coverage tools to ensure sufficiency. Deployment and monitoring: Use Docker containers to package deployments, set up data backups, and track performance and errors with logging and monitoring tools.
