草庐IT

pthread_self

全部标签

ios - 在调用另一个引用 self 的方法的 block 内调用一个方法会导致保留周期吗?

doFirst能否在此处导致保留循环?@interfaceExample:NSObject@property(nonatomic,strong)void(^block)();@end@implementationExample-(void)doFirst{__weakidweakSelf=self;self.block=^{[weakSelfdoSecond];};self.block();}-(void)doSecond{self.value=//...//dootherstuffinvolvingself}@end 最佳答案 与

ios - Xcode 6.3/iOS 8.3 中的新功能 : using self alloc for convenience constructor causes build error

此代码在Xcode6.2和6.3之间没有变化,但包含[selfalloc]的行现在导致错误:发现多个名为“initWithType:”的方法具有不匹配的结果、参数类型或属性@implementationAGNetworkDataRequest+(instancetype)networkDataRequestWithType:(AGNetworkDataRequestType)type{AGNetworkDataRequest*r=[[selfalloc]initWithType:type];//errorherereturnr;}-(id)initWithType:(AGNetwork

ios - [self.tableview reloadData];导致闪烁

问题是UI出现然后更新:产生闪烁效果。我希望UI仅在用户进入应用程序时更新一次,因此我在ViewDidLoad中重新加载了..这是代码..任何帮助如何消除这种闪烁......一些代码示例会有所帮助。-(void)viewDidLoad{[superviewDidLoad];self.myTableView.dataSource=self;self.myTableView.delegate=self;PFQuery*getCollectionInfo=[PFQueryqueryWithClassName:@"Collection"];//makequery[getCollectionIn

ios - 一劳永逸地解决 initWithFrame :self. view.frame 20 像素(状态栏)问题

我有一个简单的UINavigationController。在init方法中,我创建并添加了一个UITableView作为subview。-(id)init{self=[superinit];if(self){NSLog(@"%@",NSStringFromCGRect(self.view.frame));//{{0,20},{320,460}}tableView=[[UITableViewalloc]initWithFrame:self.view.frame];[self.viewaddSubview:tableView];}returnself;}我发现我在处理新项目时总是遇到同样

ios - self.view setFrame 不适用于 iOS 8 和导航 Controller

有没有人注意到self.viewsetFrame在iOS8中停止与NavController一起工作。如果ViewController没有navController,它工作得很好,否则,它没有。有谁知道解决方法?目前我正在使用[self.viewsetFrame:CGRectMake(0,-100,[[UIScreenmainScreen]bounds].size.width,[[UIScreenmainScreen]bounds].size.height)];但这不再有效了 最佳答案 尝试在设置框架之前将“setTranslate

ios - 如何从 C 方法调用 Objective-C "self"

这个问题在这里已经有了答案:PassinstancemethodasfunctionpointertoCLibrary(1个回答)HowdoIgiveCfunctionapointerto'self'(callingobj)inobjective-c?(2个答案)关闭9年前。我的iOS项目中有Objective-C类,它实现了Objective-C和C代码同一个类(class)。我将扩展名更改为.mm并且这部分进展顺利。现在我想设置一个C方法来调用同一个类中的Objective-C方法。我遇到的问题是当我试图从C方法调用self时。这是代码:voidSetNotificationLis

ios - [self.navigationController popToViewController :VC2 animated:NO]; crash

您好,我正在开发一个我应该去的应用程序:从UIViewController1到UIViewController2从UIViewController2到UIViewController3从UIViewController3到UIViewController4从UIViewController4回到UIViewController2我正在使用UINavigationController。当我使用[self.navigationControllerpushViewController:VC2animated:NO];和[self.navigationControllerpopViewCont

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

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

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