首页 技术 正文
技术 2022年11月23日
0 收藏 417 点赞 3,180 浏览 2153 个字

1、NSString转int

int a=[@”123″ intValue];同样适用于NSDictionary将NSNumber转为int 2、switch(statement) statement只支持int char 枚举

3,要看模拟器的document目录,要将其显隐

On Lion the users/[username]/library is hidden.

Use

chflags nohidden /users/[username]/library

in a terminal to display the folder.

4,iPhone的状态栏可以设置成半透明, 这是众所周知的, 用UINavigationController,在页面切换时, 如果你的子viewController的view是全屏的(480*320) 就会出现错位, 表现是所以的子view会向下偏移了 20像素

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];

self.navigationController.navigationBar.translucent = YES;

[self.navigationController.view setNeedsLayout];

self.wantsFullScreenLayout = YES;

5.objectiveC无法检测到对象是否已释放,只能自己管理好。如:UIView *uivew=[[UIview alloc]init];[uiview release];这时,无法判断uiview是否被释放掉,因为uiview依然指向一个地址,他不为nil。 6.xib文件不更新/clear后重加载时只有一片灰色。修改xib文件,运行,发现没有更新,product->clear依旧。然后将模拟器的app删除,运行,更惨,加载时只有灰色一片。最后发现虽然在文件夹有看到这个xib,但项目本身并没有引用,在项目Build Phases->Copy Bundle Resources添加xib即可。 7.ASIHTTPRequest提前终止异步请求

[[ASIHTTPRequestsharedQueue]cancelAllOperations];

8.UIVIEW层次控制置顶:[superview bringSubviewToFront:subview];置底:[superview sendSubviewToBack:subview]; 9.IOS5.1 对打开系统偏好设置的方式己被禁用。此前IOS5是可用的。

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=TWITTER"]];

10.字符串是否含有某字符串

[str rangOfString:@”abc”].length > 0 11.subviews of uiscrollview今天遍历uiscrollview subviews时发现在0,1位置多了两个水imageview,估计是水平和垂直滚动的指示器。 12.移除UIView上所有的subViews 除了遍历移除subView 还可以用这个方法: [[self.view subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)]; 13.UIBarButtonItem 添加ActionUIButton可以用addTarget,UIBarButtonItem没有这个方法,而是直接用:setAction14.判断是否retina屏幕

#define isRetina ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].s

ize) : NO)

 

15.withObject:传入整型参数

[self performSelector:@selector(frontButtonScaleUp) withObject:[NSNumber numberWithInt:[sender tag]] afterDelay:delay - elapsed];
[self performSelector:@selector(frontButtonScaleUp) withObject:(id)[sender tag] afterDelay:delay - elapsed];

16.清除UIwebview产的的缓存有时以页面形式加载,当页面更新时,再次访问也是缓存,怎么清空呢?

[[NSURLCachesharedURLCache] removeAllCachedResponses];

17.屏幕旋转无法触发[window addSubview:viewController.view]无法触发。改为[window setRootViewController:viewController];//仅iOS4.0及以上支持。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,966
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,487
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,332
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,115
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,748
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,783