1.刷新单个tableviewcell
2.
BOOL isss=
int (^oneFrom)(int) = ^(int anInt) {
};
4.
UIImageView * iv = [[UIImageView alloc] initWithFrame:CGRectMake(250, 5, 50, 34)];
5. 默认为cell第一行
6.一个项目中
点击项目--》TARGETS-》Build Phases
1.如果是ARC项目,要加入非ARC的代码文件
2.如果是非ARC,要加入ARC的代码
//
//
//
//
//
//
7.距离感应器
UIDeviceOrientation orientation3=
8.获得cookie
9.从相册中只获得视频文件
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerS
KiloNetAppDelegate *appdelegate = (KiloNetAppDelegate *)[[UIApplication sharedApplication] delegate];
11.键盘透明
textField.keyboardAppearance = UIKeyboardAppearanceAler Error
解决办法:
NSString*url
13.请求中加cookie、 heard
当你需要添加更多的请求信息时,如,添加个请求Header:
[request addRequestHeader:@"name" value:@"Jory lee"];
14
[dictplist setObject:self.strWeb_id forKey:@"web_id"];
15.获取文件夹的大小
-(long long) fileSizeAtPath:(NSString*) filePath{
}
16.改变tablevlewcell点击的颜色
cell.selectedBackgroundView = [[[UIView alloc] initWithFrame:cell.frame] autorelease];
字
cell.textLabel.highlightedTextColor
点击后,过段时间cell自动取消选中
- (void)deselect
{
}
17.改变UITableViewStyleGrouped背景颜色
self.tableVieww.backgroundColor =[UIColor colorWithPatternImage:[UIImage imageNamed:@"更多背景图.png"]];
18.视图反转
//垂直
19.改变icon的阴影圆圈,取消图标上的高光
gloss
20.动态UIlable后添加图片
//判断男女
//时间差
- (NSString *)intervalSinceNow: (NSString *) theDate
{
}
22.按钮在cell上单击第几行
在cell.contentView上:
//获得row
NSInteger row = [[self.tableView indexPathForCell:(UITableViewCell *)[[sender superview] superview]] row];
//获得section
NSInteger row = [[self.tableView indexPathForCell:(UITableViewCell *)[[sender superview] superview]] section];
//获得indexPath
NSIndexPath *indexPath = [self.tableView indexPathForCell:(UITableViewCell *)[[sender superview] superview]];
- (void)
{
}
24.模拟器不能运行的错误
dyld: Library not loaded: @rpath/SenTestingKit.framework/Versi*****/A/SenTestingKit
把SentestingKit。 frameWork 有原来的required改为Optional
25.还原状态栏
显示原来的状态栏
//重新设定标题栏显示的位置
(2)
在别的页面[[UIApplication
- (int)getVideopTime:(NSURL * )videourl
{
}
27.视频播放器 循环播放 大小……
(2).avplayer
[[NSNotificationCenter defaultCenter] addObserver:self
- (void)playerItemDidReachEnd:(NSNotification *)notification {
}
28.sina微博错误返回值格式
http://open.weibo.com/wiki/Error_code
29.ios 获得文件夹的大小
//计算文件夹下文件的总大小
-(long)fileSizeForDir:(NSString*)path
{
30.
//搜索用谓词过滤数组
31.多线程的多种创建
//
//
//[NSThread detachNewThreadSelector:@selector(thAction) toTarget:self withObject:nil];
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
32.用多线程开启Nstimer提高精确度
//用多线程开启nstimer提高精确度
- (void)mutiThread
{
}
- (void)timerAction:(NSTimer * )timer
{
}
33.判断此页面是push,还是模态过来的
34。等比例放大缩小视图
35.清掉编译文件
~/Library/Developer/Xcode/DerivedData
模拟器清空编译
~/Library/Application Support/iPhone Simulator/
36.改变状态栏的颜色状态
37.给自己的项目中添加特殊的标示符号
http://patorjk.com/software/taag/#p=moreopts&h=0&v=1&f=优雅&t=V
38 清空某个文件夹
39. 在document下创建文件
40.layoutSubviews在以下情况下会被调用:
1、init初始化不会触发layoutSubviews
2、addSubview会触发layoutSubviews
3、设置view的Frame会触发layoutSubviews,当然前提是frame的值设置前后发生了变化
4、滚动一个UIScrollView会触发layoutSubviews
5、旋转Screen会触发父UIView上的layoutSubviews事件
6、改变一个UIView大小的时候也会触发父UIView上的layoutSubviews事件
41.苹果审核加急通道
https://developer.apple.com/appstore/contact/?topic=expedite
51 .美化配置git log
$ git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)
52. Default.png 添加动画
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOp
{
}
53.调用系统 电话, 特定的页面
1、调用 电话phone
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://4008008288"]];
2、调用自带 浏览器 safari
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.zhece.com"]];
3、调用 自带mail
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://admin@abt.com"]];
4、调用 SMS
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://800888"]];
5,跳转到系统设置相关界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]];
其中,发短信,发Email的功能只能填写要发送的地址或号码,无法初始化发送内容,如果想实现内容的话,还需要更复杂一些,实现其各自的委托方法。
若需要传递内容可以做如下操作:
加入:MessageUI.framework
#import
实现代理:MFMessageComposeViewCont rollerDelegate
- 调用sendSMS函数
- //内容,收件人列表
- -
(void)sendSMS:(NSString *)bodyOfMessage recipientList:(NSArray *)recipients - {
-
-
MFMessageComposeViewCont roller *controller = [[[MFMessageComposeViewCont roller alloc] init] autorelease]; -
-
if([MFMessageComposeViewCont roller canSendText]) -
-
{ -
-
controller.body = bodyOfMessage; -
-
controller.recipients = recipients; -
-
controller.messageComposeDelegate = self; -
-
[self presentModalViewControll er:controller animated:YES]; -
-
} -
- }
-
- //
处理发送完的响应结果 - -
(void)messageComposeViewContro ller:(MFMessageComposeViewCont roller *)controller didFinishWithResult:(MessageComposeResult)result - {
-
[self dismissModalViewControll erAnimated:YES]; -
-
if (result == MessageComposeResultCanc elled) -
NSLog(@"Message cancelled") -
else if (result == MessageComposeResultSent ) -
NSLog(@"Message sent") -
else -
NSLog(@"Message failed") - }
-
-
- 发送邮件的为:
- 导入#import
- 实现代理:MFMailComposeViewControl
lerDelegate -
- //发送邮件
- -(void)sendMail:(NSString
*)subject content:(NSString *)content{ -
-
MFMailComposeViewControl ler *controller = [[[MFMailComposeViewControl ler alloc] init] autorelease]; -
-
if([MFMailComposeViewControl ler canSendMail]) -
-
{ -
-
[controller setSubject:subject]; -
-
[controller setMessageBody:content isHTML:NO]; -
-
controller.mailComposeDelegate = self; -
-
[self presentModalViewControll er:controller animated:YES]; -
-
} - }
-
- //邮件完成处理
- -(void)mailComposeController:(MFMailComposeViewControl
ler *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{ -
-
[self dismissModalViewControll erAnimated:YES]; -
-
if (result == MessageComposeResultCanc elled) -
NSLog(@"Message cancelled"); -
else if (result == MessageComposeResultSent ) -
NSLog(@"Message sent"); -
else -
NSLog(@"Message failed"); -
- }
-
- 默认发送短信的界面为英文的,解决办法为:在.xib
中的Localization添加一組chinese -
- 54.程序中获取软件的版本号和app名称
- 应用程序的名称和版本号等信息都保存在mainBundle的infoDictionary字典中,用下面代码可以取出来。
- NSDictionary*
infoDict =[[NSBundle mainBundle] infoDictionary]; - NSString*
versionNum =[infoDict objectForKey:@"CFBundleVersion"];//版本名称 - NSString*appName
=[infoDict objectForKey:@"CFBundleDisplayName"];//app名称 - NSString*text
=[NSString stringWithFormat:@"%@ %@",appName,versionNum];
55.如何使屏幕一直保持唤醒状态?(就是不自动黑屏) [一下几条技术点 转自:路不平 博客]
比如,如果我们做一个播放视频的功能时,想在播放的时候,不会自动进入屏保(黑屏)
只要在代码里加入这一行:
- [[UIApplication
sharedApplication] setIdleTimerDisabled:YES];
当然,在想要黑屏的时候还需要把它设置为NO(比如视频播放完毕时),不然屏幕会在此软件运行下一直亮着。 - 应用程序的名称和版本号等信息都保存在mainBundle的infoDictionary字典中,用下面代码可以取出来。
- 56。如何设置视图(view)在最上层?或是view1和view2交换?
- self.view
exchangeSubviewAtIndex:withSubviewAtIndex:];
58,图片模糊化处理
- +(UIImage
*)scale:(UIImage *)image toSize:(CGSize)size - {
-
UIGraphicsBeginImageCont ext(size); -
[image drawInRect:CGRectMake(0, 0, size.width, size.height)]; -
UIImage *scaledImage = UIGraphicsGetImageFromCu rrentImageContext(); -
UIGraphicsEndImageContex t(); -
return scaledImage; - }
beginBackgroundTaskWithE xpirationHandler
方法,让app最多有10分钟的时间在后台长久运行。这个时间可以用来做清理本地缓存,发送统计数据等工作