在popover中的ViewController中实现:
- (void)viewWillAppear:(BOOL)animated
{
CGSize size = CGSizeMake(320, 480); // size of view in popover
self.contentSizeForViewInPopover = size;
[super viewWillAppear:animated];
}
tableview 滑动导致 NSTimer和delegate 回调停止 解决办法
// request回调
NSURLRequest *request = ...
NSURLConnection *connection = [[NSURLConnection alloc]
initWithRequest:request
delegate:self
startImmediately:NO];
[connection scheduleInRunLoop:[NSRunLoop currentRunLoop]
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];