随笔分类 - 苹果相关
摘要:来自IOS7 by tutorials 下面是个人的一点翻译总结 1,首先在初始化方法李画一个方块UIView* square = [[UIViewalloc]initWithFrame:CGRectMake(100,100,100,100)];square.backgroundColor= [...
阅读全文
摘要:1,@property (nonatomic,readwrite)NSInteger score;注意这里有一个只读和只写的属性,readonly.2,重写初始化方法也可以改名字和传参数,(改名一般以initWith开头),-(instancetype) initWithCardCount:(NSU...
阅读全文
摘要:1,OC里面传参数个数不同,可以是两个完全不同的方法。如- (void)addCard:(Card *)card atTop:(BOOL)atTop;- (void)addCard:(Card *)card;第二个方法可以这样实现- (void)addCard:(Card *)card{ [self...
阅读全文
摘要:1,引入文件,#import IOS7 中可以这样写@import Foundation;2,在.h文件引入的是公用的,在.m文件里面引用的是本类私有的。私有属性声明@interface Card()//在这里面声明@property (strong) NSString *contents;@end...
阅读全文
摘要:1,项目名本地化点击项目,蓝色图标->info 最下面+号,添加chinese本地化。Supporting Files->infoPlist.strings 下会有两个文件,有一个是设置中文的,也就是你刚刚添加的。在相应文件里添加CFBundleDisplayName="炸金花”; 来设置你的app...
阅读全文
摘要:1,睡眠方法。[NSThread sleepForTimeInterval:3];关于程序睡眠这里收集了两种方法,看下面代码- (IBAction)setButton:(id)sender { _label.text = @"对方正在思考"; [self performSelector:@sele...
阅读全文
摘要:1,播放短音频#import #import "GLYViewController.h"static void completionCallback(SystemSoundID mySSID){ AudioServicesPlaySystemSound(mySSID);}@interface ...
阅读全文
摘要:NSDate * date = [NSCalendarDate date]; NSLog(@"%@", date);日历在IOS里报错,,。 NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter ...
阅读全文
摘要://向下个视图传值#pragma mark - Navigation- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{//你连接的 identifier 的内容 if ([[segue identifier] ...
阅读全文
摘要:// IOS相应路径 NSString* bundlePath = [[NSBundle mainBundle] bundlePath]; NSLog(@"bundlePath = %@", bundlePath);// documents NSString* documentsDirec...
阅读全文
摘要:刚刚遇到的两个错误,。1,Terminating app due to uncaught exception'NSGenericException', reason: 'Push segues can only be used when the sourcecontroller is managed...
阅读全文
摘要:在View的UITextField中经常需要输入完文字后隐藏软键盘,要实现着一点要让View的Controller实现UITextFieldDelegate代理,然后编写相应的代码。#import @interface TestVeiwController : UIViewController {I...
阅读全文
摘要:[[UIScreen mainScreen] bounds].size.width[[UIScreenmainScreen]bounds].size.height得到屏幕的宽高,然后将变量写入CGRectmake
阅读全文
摘要:发表于昨天(23:33)(2013-11-03 23:33) ,已有15次阅读 ,共0个评论摘要:总结OC中数组排序3种方法:sortedArrayUsingSelector:;sortedArrayUsingComparator:;sortedArrayUsingDescriptors:大体上,O...
阅读全文
摘要:NSData,数据,当我们需要把一些信息写入到文件里或发送到网络上,我们需要把这些数据转换下,变成纯粹的0、1字符流数组转 NSDataNSData *GLYtime = [NSKeyedArchiverarchivedDataWithRootObject:Gtime];字符串转NSData1 NS...
阅读全文
摘要:NSString类中提供了这样三个方法用于获取子字符串:–substringFromIndex:–substringWithRange:–substringToIndex:它们该怎么使用呢?见下面代码即可知道。NSString*str =@"12345";//NSString *subString0...
阅读全文
摘要:在Objective-C中,以数字格式组成的字符串经常需要转换为NSNumber对象后再使用。例如有一个字符串对象@"111.22",需要转为NSNumber对象,最简单的方法就是这样:[NSNumber numberWithFloat:[@"111.22" floatValue]]。这个方法先使用...
阅读全文
摘要:这条错误主要还得看unrecognized前面,,我的时[NSNumber-length...]其实是变量类型错误。。无法识别选择器发送实例,,本来意思就是你的controllerview找不到视图文件。。。不过我这是把一个项目删了,重新建立了一个 名字相同的文件,,然后报这个错误,,重新设置虚拟器...
阅读全文
摘要:说什么数据不兼容,,,,这时删除模拟器的应用,,,重新启动测试。
阅读全文
摘要:我出这个错误是因为,自己的一个视图没有给指定想用的viewController文件。。及一个classController控制一个xib文件,忘给该视图指定控制器了。
阅读全文
浙公网安备 33010602011771号