在popover中的ViewController中实现:
- (void)viewWillAppear:(BOOL)animated
{
CGSize size = CGSizeMake(320, 480); // size of view in popover
self.contentSizeForViewInPopover = size;
[superviewWillAppear:animated];
}
tableview 滑动导致 NSTimer和delegate 回调停止 解决办法
// request回调
NSURLRequest*request=...
NSURLConnection*connection=[[NSURLConnectionalloc]
initWithRequest:request
delegate:self
startImmediately:NO];
[connection scheduleInRunLoop:[NSRunLoopcurrentRunLoop]
forMode:NSRunLoopCommonModes];
[connection start];
//timer 回调
NSTimer *updateTimer = [NSTimer scheduledTimerWithTimeInterval:0.01f target:self selector:@selector(updatePencent) userInfo:nil repeats:YES];
NSRunLoop *main=[NSRunLoop currentRunLoop];
[main addTimer:updateTimer forMode:NSRunLoopCommonModes];
解决iOS应用滑动导致NSTimer和delegate回调停止的问题
本文介绍了在iOS开发中遇到的一个常见问题:当使用NSTimer和delegate回调时,滑动操作可能导致回调停止。通过在viewWillAppear方法中设置view的ContentSizeForViewInPopover属性来解决此问题,确保定时器和代理回调在滚动时正常工作。
2895

被折叠的 条评论
为什么被折叠?



