码迷,mamicode.com
首页 > 移动开发 > 详细

ios 开发小记 (二)

时间:2015-09-15 21:33:56      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:

identity inspector 的key path 可以用来做圆角按钮和边框。

 layer.cornerRadius number  圆角按钮

 

使用代理模式的时候,要注意,A 和 B的引用之间会循环引用,导致内存无法回收。 可以使引用设置为weak。
 
 
 
navigationBar 默认是透明的,颜色会进行高斯模糊处理。所以直接用RGB颜色赋值,最后的颜色效果会稍微淡一些。
解决方案:最开始的navigationBar设置为opaque。
 
 
 
ios3.0 以后 苹果的sdk对这种情况做了调整,如果是post请求,并且设置了 httpBody,那么请求的超时时间就被默认设置为 240 秒了。就算你再使用[urlRequest setTimeoutInterval:10];也是无效的,我们可以再设置完成后再读取这个值,发现它不会变成10,依然保持240秒。
 
 
 
presentViewController 和  UINavigationController的区别:
 
presentViewController 一般用于一个viewcontroller
 
同时,dismiss会让所有的presents的view全部消失。(go back,不方便)

UINavigationController 更灵活,可以push,然后pop。
 
 
UITableViewCell 的高度动态生成,
return cell.contentView.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize).height + 1 。
这个systemLayoutSizeFittingSize 可以用来测试高度。(先填入数据,初始化完后, 调用这个接口返回相应高度)
 
 
其他线程如何操作(更新)UI。

[self performSelectorOnMainThread:@selector(updateUI:) withObject:image waitUntilDone:YES];

performSelectorOnMainThread是NSObject的方法,除了可以更新主线程的数据外,还可以更新其他线程的比如: 
用:performSelector:onThread:withObject:waitUntilDone: 
 
 

 

 

layout有三种方式:Manual layout,Autoresizing,Autolayout。我们常用的可能就后面两种。

假设v1是一个不使用autolayout的view,而v2是一个使用autolayout的view,但v1成为v2的subview时,

v2需要四条隐含的constraint来确定v1的位置,这些约束都是从v1的frame转化而来:

This conversion is performed only if the view in question has its translates-

AutoresizingMaskIntoConstraints property set to YES. That is, in fact, the default if

the view came into existence either in code or by instantiation from a nib where “Use

Auto Layout” is not checked. The assumption is that if a view came into existence in

either of those ways, you want its frame and autoresizingMask to act as its constraints

 
if it becomes involved in autolayout. 
 
 
 
 
 
 
 
能不能在destination controller 中调用prepareForSegue 来回传数据?
不能。
因为:prepareForSegue只有当将一个controller放到堆栈上面的时候可以使用,如果将一个controller从堆栈上面移除,是无法使用的,具有单向性。
 
self.navigationController popToRootViewControllerAnimated:YES]
 
 
UIViewController *prevVC = [self.navigationController.viewControllers objectAtIndex:<n>];
[self.navigationController popToViewController:prevVC animated:YES];

[self.navigationController popViewControllerAnimated:YES];

 

 

移出孩子的操作
If you are implementing your own container view controller, it must call the willMoveToParentViewController: method of the child view controller before calling the removeFromParentViewController method...

Thus, as discussed in Adding and Removing a Child section of the View Controller Programming Guide, when removing a child, we should:


[childVC willMoveToParentViewController:nil];
[childVC.view removeFromSuperview];
[childVC removeFromParentViewController];
 

ios 开发小记 (二)

标签:

原文地址:http://www.cnblogs.com/loying/p/4811356.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!