31.状态栏的网络活动风火轮是否旋转
[UIApplication sharedApplication].networkActivityIndicatorVisible,默认值是NO。
32.线程使用
//创建线程
[NSThread detachNewThreadSelector:@selector(myMethod) toTarget:selfwithObject:nil];
//线程方法
- (void)myMethod
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
*** code that should be run in the new thread goes here ***
[pool release];
}
//在主线程中调用
[self performSelectorOnMainThread:@selector(myMethod) withObject:nilwaitUntilDone:false];
33 app Icon显示数字:
-(void)applicationDidEnterBackground:(UIApplication *)application{
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:5];
}
34.UIScrollView 设置滑动不超出本身范围:
[fcScrollView setBounces:NO];
35. NSArray查找是否存在对象时用indexOfObject,如果不存在则返回为NSNotFound.
36. 在使用UISearchBar时,将背景色设定为clearColor,或者将translucent设为YES,都不能使背景透明,经过一番研究,发现了一种超级简单和实用的方法:
[[searchbar.subviewsobjectAtIndex:0]removeFromSuperview];
背景完全消除了,只剩下搜索框本身了。
37. 对图层的操作:
(1.给图层添加背景图片:
myView.layer.contents = (id)[UIImageimageNamed:@"view_BG.png"].CGImage;
(2.将图层的边框设置为圆脚
myWebView.layer.cornerRadius = 8;
myWebView.layer.masksToBounds = YES;
(3.给图层添加一个有色边框
myWebView.layer.borderWidth = 5;
myWebView.layer.borderColor = [[UIColorcolorWithRed:0.52 green:0.09 blue:0.07 alpha:1] CGColor];