草庐IT

self-register

全部标签

ios - UICollectionViewController 的布局所有权(self.collectionView.collectionViewLayout 与 self.collectionViewLayout)

我有一个UICollectionViewController管理一个CollectionView,该CollectionView针对不同的应用程序状态使用不同的布局。我正在使用-setCollectionViewLayout:animated:在不同布局之间进行转换。我遇到了错误的访问错误,如果知道CollectionView的当前布局实际拥有(例如,保留对strong的引用),这将非常有帮助。调用-setCollectionViewLayout:animated:后,我注意到以下内容(其中self是UICollectionViewController):self.collection

ios - "More than maximum 5 filtered albums trying to register. This will fail."使用 Assets 库

我有时会收到“超过最多5个筛选相册试图注册。这将失败。”当我在ALAssetsGroup上调用setAssetsFilter时。谁知道为什么?我见过类似的问题,但都与UIImagePickerController相关。这里是代码:ALAssetsLibrary*lib=[[ALAssetsLibraryalloc]init];[libenumerateGroupsWithTypes:ALAssetsGroupSavedPhotosusingBlock:^(ALAssetsGroup*group,BOOL*stop){[groupsetAssetsFilter:[ALAssetsFilt

ios - "self"在 iOS 5.1 上的调试器中不可用

我正在尝试调试在iOS5.1下运行的问题,当我在出现错误的代码内的调试器中停止并尝试使用调试器打印一些内容时,我收到消息:error:warning:StoppedinacontextclaimingtocaptureanObjective-Cobjectpointer,but'self'isn'tavailable;pretendingweareinagenericcontext对不起?有人知道我在这里对自己做了什么吗?代码太复杂了,任何人都不想看它——我主要希望有人能告诉我调试器消息的含义。这过去只是间歇性地失败,但现在大部分时间都失败了。该操作通常(或可能总是)在我第一次在iOS

iphone - 当我初始化自定义单元格时返回 'self' 而它没有设置为 '[(super or self) init...]' 的结果

在CustomCell.m中,我定义了我想从IB加载单元格的init方法:-(id)init{self=[superinit];if(self){NSArray*nib=[[NSBundlemainBundle]loadNibNamed:@"CustomCell"owner:selfoptions:nil];self=[nibobjectAtIndex:0];}returnself;}在MyTableViewController.m的cellForRowAtIndexPath方法中,我初始化了我的自定义单元格-(UITableViewCell*)tableView:(UITableVi

ios - UITextField 的 resignFirstResponder 既不工作也不工作 self.view.endEditing()

我正面临textField的荒谬问题,我有两个文本字段,即tfA和tfB,我已经为这些文本字段设置了代表和所有内容,我想要的是,如果我单击tfA,它应该打印一些东西,并且它正在打印,如果我单击tfB,它应该会出现键盘,它也运行良好,但是当我再次单击tfA时,它应该打印一些东西,键盘应该根据那里给出的条件关闭,但键盘没有关闭此外,self.view.endEditing(true)在这里不起作用。下面给出了代码和屏幕截图,我在这里做错了什么?代码:Swift3importUIKitclassViewController:UIViewController,UITextFieldDelega

iphone - 更改 UIView 的 CALayer 框架(self.view.layer.frame = ...)似乎没有效果

我确定我在这里遗漏了一些基本的东西。我正在尝试来自以下位置的CALayers'helloworld'代码:http://www.raywenderlich.com/2502/introduction-to-calayers-tutorial做第一个例子。xcode4.2中的新单View项目。Nib/Storyboard没有变化。导入quartz核。将以下代码添加到ViewController.m中的ViewDidLoad中:-(void)viewDidLoad{[superviewDidLoad];self.view.layer.backgroundColor=[UIColorblue

ios - 第二次加载 ViewController 时,self.navigationController 为 nil

我有一个在我的UIViewControllers上实现的委托(delegate)/处理程序来处理远程web服务的超时。当向我的网络服务发出请求并返回超时http代码时,委托(delegate)将被调用并执行以下操作:UINavigationController*navController=self.navigationController;if(navController){[navControllerpopToRootViewControllerAnimated:YES];}else{NSLog(@"navControllerisnull/nil");}如果我执行以下步骤,navCo

ios - block 中的宏捕获 self

我用下面的宏来记录各种信息有问题#defineJELogVerbose(fmt,...)DDLogVerbose((@"%@%@-"fmt),NSStringFromClass([selfclass]),NSStringFromSelector(_cmd),##__VA_ARGS__)当在block中使用这个final宏时会出现问题,它显然会强烈捕获self,这可能会有问题。以下是解决方案的一些要求:它可以是一个多行宏,您可以在其中定义weakSelf但这并不能解决问题,因为您可以重新定义您创建的__weak指针。使用__FILE__或__PRETTY_FUNCTION__因为它们捕获

iphone - 为什么 self.bounds.size.height 没有考虑这段代码中的 UINavigationView 导航栏?

我有一个配置UITableView,可以通过UINavigationController方法启动颜色选择器:[self.navigationControllerpushViewController:colorPickerViewControlleranimated:YES];[colorPickerViewControllerrelease];这意味着ColourPicker的顶部将有一个导航栏(和后退按钮)ColourPickerViewControll及其ViewColourPickerView的结构如下:-ColourPickerViewController-init'sXIBf

ios - 我的 self.view 尺寸错误

我的观点有错误的维度。我只运行风景,但View报告纵向尺寸“ViewWidth=768.000000Height=1024.000000”任何想法如何解决这个问题?我玩过我试过的自动旋转-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{return(interfaceOrientation==UIInterfaceOrientationLandscapeLeft||interfaceOrientation==UIInterfaceOrientationLa