草庐IT

Self-supervisedPre-training

全部标签

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

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