草庐IT

ios - Collection View :cellForItemAtIndexPath: never gets called

我有一个UICollectionView,我只是想让它显示出来。我在界面生成器中将委托(delegate)和数据源附加到文件的所有者。collectionView:numberOfItemsInSection:被调用就好了。我已经搞砸了几个小时,就是想不通......任何帮助都会很棒,提前致谢!这是完整的源代码。对不起,如果它有点乱。.h文件#import#import#import"PinAnnotation.h"#import"Jot.h"@interfaceJotCardViewController:UIViewController@property(nonatomic,stro

ios - 为什么 didReceiveRemoteNotification :fetchCompletionHandler is called but usual didReceiveRemoteNotification isn't?

在我的应用程序中,我有两种类型的推送通知:带有content-available=1标志的远程静默通知和带有body、badge和其他东西。我还定义了两个委托(delegate)方法didReceiveRemoteNotification:fetchCompletionHandler和常用的didReceiveRemoteNotification。但是当没有content-available标志的推送通知到达时,调用didReceiveRemoteNotification:fetchCompletionHandler,而不是didReceiveRemoteNotification。如何

ios - 为什么 - (void)tableView :(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section not called

-(void)tableView:(UITableView*)tableViewwillDisplayHeaderView:(UIView*)viewforSection:(NSInteger)section{[viewvChangeBackgroundToCyan];}之后[self.delegateForTableController.tvDelegatedinsertSections:[NSIndexSetindexSetWithIndex:ip.section]withRowAnimation:UITableViewRowAnimationRight];如何称呼他们?

ios - NSURLSessionTaskDelegate 方法 URLSession :task:didCompleteWithError: never called

我所有的网络代码都依赖于NSURLSession委托(delegate)方法——而不是完成处理程序。我的数据和下载任务都很好,但我的上传任务从来没有导致URLSession:task:didCompleteWithError:被调用。但是,那URLSession:dataTask:didReceiveData:和URLSession:dataTask:willCacheResponse:completionHandler:委托(delegate)方法被调用。如果我在我的session对象上将资源超时设置为非常低的值,那么didCompleteWithErrors会被调用,但这显然不是解

ios - 应用程序 :didReceiveLocalNotification never called on ios 8

是否存在任何已知问题:application:didReceiveLocalNotificationdelegate在iOS8上?我的应用程序使用UILocalNotification创建本地通知。当应用程序在后台时,我会收到通知,当我单击通知横幅时,它会移动到我的应用程序。但是这个方法:-(void)application:(UIApplication*)applicationdidReceiveLocalNotification:(UILocalNotification*)notification从不在iOS8(Xcode5.1.1)上调用,但在iOS7或更早版本上运行良好。附言我

ios - 应用程序将终止 : not being called

我正在使用applicationWillTerminate:来保存一些最后一刻的东西。但问题是它永远不会被调用。如果我在方法的顶部执行类似这样的操作:NSLog(@"Something");它不会被调用,也不会输出到控制台。有人知道为什么会这样吗? 最佳答案 来自Apple文档:对于不支持后台执行或链接到iOS3.x或更早版本的应用程序,此方法总是在用户退出应用程序时调用。对于支持后台执行的应用程序,当用户退出应用程序时通常不会调用此方法,因为在这种情况下应用程序只是移至后台。但是,在应用程序在后台运行(未挂起)并且系统出于某种原因

objective-c - mapViewDidFinishLoadingMap : called too early

我的问题很简单:我正在等待截取MKMapView的屏幕截图,并且我只想在加载map后执行此操作。不幸的是,这个委托(delegate)方法几乎总是在map实际加载之前被调用。如果我幸运的话,我只是得到一个网格,或者一些加载的瓷砖。有什么好方法可以做我需要做的事吗?还是我在MKMapViewDelegate协议(protocol)中遗漏了什么?谢谢! 最佳答案 也许您可以尝试添加一个计时器,然后在计时器的完成block中截取屏幕截图。或者,使用mapView:didUpdateUserLocation:委托(delegate)方法作为

ios - 是否可以调用 performSelectorOnMainThread : after beginBackgroundTaskWithExpirationHandler is called and the application is in background?

我正在启动后台任务,如下所示:UIApplication*application=[UIApplicationsharedApplication];_backgroundTask=[[UIApplicationsharedApplication]beginBackgroundTaskWithExpirationHandler:^{[applicationendBackgroundTask:_backgroundTask];_backgroundTask=UIBackgroundTaskInvalid;}];应用程序被发送到后台,一切正常。一段时间后,满足特定条件,某些对象最终执行此代码

ios - 原因 - (void)cancelTrackingWithEvent :(UIEvent *)event getting called If I am using MSSlideNavigationController?

我尝试在我的ViewController中使用自定义UIControl。我的自定义类是UIControl的子类,并为我的自定义控件分配实例并通过以下代码添加到我的ViewController的View中CustomControl*customControl=[[CustomControlalloc]initWithFrame:CGRectMake(44,388,235,160)];[self.viewaddSubview:customControl];然后我在CustomControl中实现以下委托(delegate)方法-(BOOL)beginTrackingWithTouch:(U

ios - cellForItemAtIndexPath : is not called when using custom UICollectionViewLayout subclass

当使用我的自定义UICollectionViewLayout子类时,cellForItemAtIndexPath:没有被调用(我使用断点和调试输出进行了检查)。这就是我使用自定义布局的方式:-(void)viewDidLoad{[superviewDidLoad];DMSGridLayout*gridLayout=[[DMSGridLayoutalloc]init];//UICollectionViewFlowLayout*flow=[[UICollectionViewFlowLayoutalloc]init];//[flowsetItemSize:CGSizeMake(150,150