Sportica   Sportica

随笔分类 -  objective-c

摘要:出现这个的原因是因为xcode 升级了。那么只需要改一个参数就好了。找到 TARGETS--选择Build Settings 然后再下面的列表中找到 Architectures 把上面的armv7s 这个参数删除改为armv7 这样就妥妥的了。 阅读全文
posted @ 2013-01-17 14:40 qingjoin 阅读(438) 评论(0) 推荐(0) 编辑
摘要:[punishIDTXFagain setKeyboardType:UIKeyboardTypeNumberPad ]; //输入法只能为数字//其它的输入法UIKeyboardTypeDefault, // Default type for the current input method. UIKeyboardTypeASCIICapable, // Displays a keyboard which can enter ASCII characters, non-ASCII keyboards remain active UI... 阅读全文
posted @ 2012-12-29 13:35 qingjoin 阅读(296) 评论(0) 推荐(0) 编辑
摘要:12.判断邮箱格式是否正确的代码://利用正则表达式验证-(BOOL)isValidateEmail:(NSString *)email{NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES%@",emailRegex];return [emailTest evaluateWithObject:email];}13. 阅读全文
posted @ 2012-12-24 18:04 qingjoin 阅读(707) 评论(0) 推荐(0) 编辑
摘要://判断roadTitleLab.text 是否含有qingjoin if([roadTitleLab.text rangeOfString:@"qingjoin"].location !=NSNotFound)//_roaldSearchText { NSLog(@"yes"); } else { NSLog(@"no"); } 阅读全文
posted @ 2012-12-14 11:09 qingjoin 阅读(97985) 评论(0) 推荐(2) 编辑
摘要:NSString *msg; msg = [NSString stringWithFormat:@"%@",[[[DATA.specificSearchList objectAtIndex:indexPath.row]objectForKey:@"content"] stringByReplacingOccurrencesOfString:@"\\n" withString:@" \r\n" ]];label.numberOfLines = 0; //不要忘记设置这个label.text = msg; 阅读全文
posted @ 2012-12-04 17:30 qingjoin 阅读(14140) 评论(2) 推荐(1) 编辑
摘要:NSString *str = [NSString stringWithFormat:@"https://itunes.apple.com/cn/app/zhang-xiao-tong-lao-shi-ban/id562675943?mt=8"]; //https://itunes.apple.com/cn/app/zhang-xiao-tong-jia-zhang-ban/id562206389?mt=8 家长版 //https://itunes.apple.com/cn/app/zhang-xiao-tong-lao-shi-ban/id562675943?... 阅读全文
posted @ 2012-11-30 10:07 qingjoin 阅读(1229) 评论(0) 推荐(0) 编辑
摘要:delegate protocol 是objective-c 语法的一部分 但他们两个却完全不是一回事。主要是我们经常在同一个文件里见到这两个东西protocol(协议)我的理解就是定义这么一个东西。以后就按这里的规定来办事。delegate(委托) 就是把事情委托给别人去办@required 就是必须去办的。比如UITableView delegate里面的:-(NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section这个就是必须要实现的方法@optional则是可做或不做。比如T 阅读全文
posted @ 2012-11-22 14:15 qingjoin 阅读(13876) 评论(3) 推荐(2) 编辑
摘要:protocol和delegate完全不是一回事,放在一起说,只是因为我们经常在同一个头文件里看到这两个word。 协议(protocol),就是使用了这个协议后就要按照这个协议来办事,协议要求实现的方法就一定要实现。 委托(delegate),顾名思义就是委托别人办事,就是当 一件事情发生后,自己不处理,让别人来处理。 举个浅显的例子: 我上班的工作主要内容包括 (1)写代码(2)写文档(3)测试程序(4)接电话(5)会见客户(1)(2)我自己全权负责,但是后面(3)(4)(5)我不想或者不方便自己做,所以我想找个助手(delegate)帮我做这些事,于是我定了一个招聘要... 阅读全文
posted @ 2012-11-20 16:37 qingjoin 阅读(484) 评论(0) 推荐(0) 编辑
摘要:-(void)viewDidLoad{//向右滑动_swipeGestureRecognizer=[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeFrom:)]; [_swipeGestureRecognizer setDirection:UISwipeGestureRecognizerDirectionRight]; [self.view addGestureRecognizer:_swipeGestureRecognizer];//左 [_swipeGesture... 阅读全文
posted @ 2012-11-20 11:17 qingjoin 阅读(5209) 评论(0) 推荐(0) 编辑
摘要:ABAddressBookRef addressBook = ABAddressBookCreate(); CFArrayRef results = ABAddressBookCopyArrayOfAllPeople(addressBook); for(int i = 0; i < CFArrayGetCount(results); i++) { ABRecordRef person = CFArrayGetValueAtIndex(results, i); //读取firstname NSString *personName... 阅读全文
posted @ 2012-11-19 14:19 qingjoin 阅读(10818) 评论(0) 推荐(0) 编辑
摘要://首先建立基于UDP的Socket连接 AsyncUdpSocket *updSocket-(void)openUDPServer{ //初始化udp AsyncUdpSocket *tempSocket=[[AsyncUdpSocket alloc] initWithDelegate:self]; self.updSocket=tempSocket; [tempSocket release]; //绑定端口 NSError *error = nil; [self.updSocket bindToPort:4333 error:&error]; ... 阅读全文
posted @ 2012-11-16 17:09 qingjoin 阅读(4554) 评论(0) 推荐(1) 编辑
摘要:float version = [[[UIDevicecurrentDevice] systemVersion] floatValue]; 阅读全文
posted @ 2012-11-16 15:56 qingjoin 阅读(135) 评论(0) 推荐(0) 编辑
摘要:Undefined symbols for architecture i386: "_compressBound", referenced from: +[NSDataGZipAdditions compressedDataWithBytes:length:] in NSDataGZipAdditions.o "_compress", referenced from: +[NSDataGZipAdditions compressedDataWithBytes:length:] in NSDataGZipAdditions.o "_inflate 阅读全文
posted @ 2012-11-14 10:50 qingjoin 阅读(10062) 评论(0) 推荐(0) 编辑
摘要:NSString *test = [[NSString alloc] initWithString:@"qingjoin"]; 上面一段代码会执行以下两个动作 1 在堆上分配一段内存用来存储@"qingjoin" 比如:内存地址为:0X2222 内容为 "qingjion" 2 在栈上分配一段内存用来存储test 比如:地址为:0Xbbbb 内容自然为0X2222 下面分别看下assign retain copy assign的情况:NSString *newTest = [test assing]; 此时newTest和test完全 阅读全文
posted @ 2012-11-07 13:40 qingjoin 阅读(293) 评论(0) 推荐(0) 编辑
摘要://1、系统的打电话代码,不返回当前程序: [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://10086"]]; //2、用UIWebView来实现,打电话结束后会返回当前应用程序: UIWebView *callPhoneWebVw = [[UIWebView alloc] init]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"tel://10086" 阅读全文
posted @ 2012-10-31 14:05 qingjoin 阅读(254) 评论(0) 推荐(0) 编辑
摘要://像这种控件的长按事件有些地方是有系统自带的。但有些时候用起来也不太方便。下面这个可能以后能用到UILongPressGestureRecognizer *longPressReger = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)]... 阅读全文
posted @ 2012-10-31 11:15 qingjoin 阅读(17346) 评论(0) 推荐(0) 编辑
摘要://先要设Cell可编辑-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{ NSLog(@"xxxxfffwefw"); return YES;}//修改编辑按钮文字- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath{ return @"删除&q 阅读全文
posted @ 2012-10-31 09:32 qingjoin 阅读(1784) 评论(0) 推荐(0) 编辑
摘要:// 要用到Reachability.h 和Reachability.m两个文件 -(void)checkNetworkRun { NSLog(@"newtwork44"); SchoolInHandAppDelegate *app = [[UIApplication sharedApplication]delegate]; Reachability *r = [Reachability reachabilityWithHostName:@"www.apple.com"]; switch ([r currentReachabilityStatus]) { 阅读全文
posted @ 2012-10-26 16:02 qingjoin 阅读(194) 评论(0) 推荐(0) 编辑
摘要:- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ UITableViewCell *cell = [[UITableViewCell alloc]initWithFrame:CGRectMake(0, 0, 320, 30)]; cell.resultTableContent.highlightedTextColor = [UIColor blackColor]; //选中后的 颜色设置 cell.r... 阅读全文
posted @ 2012-10-12 15:31 qingjoin 阅读(311) 评论(0) 推荐(0) 编辑
摘要://首先添加framework------- libsqlite3.0.dylib//头文件#import "/usr/include/sqlite3.h" @interface ViewController : UIViewController<UIPopoverControllerDelegate, UISplitViewControllerDelegate>- (void)viewDidLoad{ [super viewDidLoad]; //打开 如果没有。则创建。 [self openDatabase]; //创建表 [self creat... 阅读全文
posted @ 2012-10-11 17:40 qingjoin 阅读(1585) 评论(0) 推荐(0) 编辑

  Sportica