Fork me on GitHub
上一页 1 ··· 77 78 79 80 81 82 83 84 85 ··· 125 下一页

2012年3月3日

摘要: 以下问题和解决方法供大家参考:某些界面不显示,定制键盘不正常。界面问题,原来是有些界面控件的行为改变了;1)比如说:UISegmentedControl,[segmentControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];原来segmentControl.selectedSegmentIndex = 0;这样的调用会导致直接调用一次segmentAction。但是在ios5中没有调用。要手动去执行一下,可以这样改,在设置完selectedSegm 阅读全文
posted @ 2012-03-03 01:34 pengyingh 阅读(601) 评论(0) 推荐(0)

2012年3月2日

摘要: NSString和NSDate互转需要用到NSDateFormatter,设置一下timezone和format即可,直接上代码 NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; NSTimeZone *timeZone = [NSTimeZone localTimeZone]; [formatter setTimeZone:timeZone]; [formatter setDateFormat : @"M/d/yyyy h:m a"]; NSString *stringTim... 阅读全文
posted @ 2012-03-02 20:41 pengyingh 阅读(4143) 评论(0) 推荐(0)
摘要: NSString *taskTitleStyle = @"font-weight: bold; color: rgb(238, 236, 224); ";NSError *error = NULL; NSString *substringForFirstMatch; NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"\\b(\\d)*\\,\\s(\\d)*\\,\\s(\\d)*\\b" ... 阅读全文
posted @ 2012-03-02 19:39 pengyingh 阅读(1409) 评论(0) 推荐(0)
摘要: ios开发中常常会用到地图控件MKMapView,可以用如下方法在点击MKMapView中某点的时候获取改点的经纬度:假如声明了一个MKMapView为myMapView1、在地图中添加一个手势,这个手势是一个点击动作,点击时会调用tapPress这个方法UITapGestureRecognizer *mTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapPress:)];[myMapView addGestureRecognizer:mTap];[mTap release];2、接下来就可 阅读全文
posted @ 2012-03-02 19:36 pengyingh 阅读(1715) 评论(0) 推荐(0)

2012年3月1日

摘要: 双向关系双向的时候,只用指定一边,另外一边自动指定,比如,如果一个帐号只有一个联系人,而一个联系人对应一个帐号的话,那么帐号表和联系人表就是一一对应的关系,将他们指定为双向的,如下面将cnt1.act = act1; cnt2.act = cnt2;则act1.cnt和act2.cnt也是有值的。注释掉的两句可有可无。删除规则这里将Account表下面的cnt的删除规则设定为cascade,则在删除act1的时候,cnt1也被删除了。而Contact表没有将它下面的act的删除规则设置为cascade,在删除cnt1的时候,act1还存在。一对多的关系上面假设一个帐号只有一个联系人是不合理的, 阅读全文
posted @ 2012-03-01 19:50 pengyingh 阅读(3444) 评论(0) 推荐(0)
摘要: - (void)Connect{ [self ConnectToServerHost:HOST Port:PORT]; [self.is setDelegate:self]; [self.os setDelegate:self]; [self.is scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [self.os scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [self.is op... 阅读全文
posted @ 2012-03-01 19:42 pengyingh 阅读(174) 评论(0) 推荐(0)
摘要: //加载Bundle中的html文件。 NSString *Path = [[NSBundle mainBundle] pathForResource:@"chat.html" ofType:nil]; [WebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:Path]]]; // 执行其中的Javascript NSString *str = [NSString stringWithFormat:@"addmsg(\"%c%c%c\")", & 阅读全文
posted @ 2012-03-01 15:50 pengyingh 阅读(231) 评论(0) 推荐(0)
摘要: 在程序退到后台的时候马上弹出一个PUSH- (void)applicationDidEnterBackground:(UIApplication *)application {/*Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. If 阅读全文
posted @ 2012-03-01 15:47 pengyingh 阅读(637) 评论(0) 推荐(0)
摘要: 目的:重用代码,将公用的东西写到一个静态库中,公用。新建一个Cocoa Touch静态库项目MyLib,编写相应代码。新建一个测试项目TestLib,打开MyLib,选中MyLib中的MyLib,拖入TestLib项目中,选中Copy。准备库头文件,加入到TestLib中。双击TestLib中Targets下的TestLib目标,在General中的Direct Dependencies中加入MyLib。点击TestLib中Targets下的TestLib目标左边的小三角,展开TestLib中的MyLib,将其中的libMyLib.a拖入Link Binary With Library中。编写 阅读全文
posted @ 2012-03-01 15:42 pengyingh 阅读(237) 评论(0) 推荐(0)
摘要: 开发项目的时候不用管显示语言的问题,在代码中任何地方要显示文字都这样调用:NSLocalizedString(@"aaa", @"bbb");这里aaa相当于关键字,它用于以后从文件中取出相应语言对应该的文字。bbb相当于注释,翻译人员可以根据bbb的内容来翻译aaa,这里的aaa与显示的内容可以一点关系也没有,只要程序员自己能看懂就行。比如,一个页面用于显示联系人列表,这里调用可以这样写。NSLocalizedString(@"shit_or_anything_you_want", @"联系人列表标题");项目写 阅读全文
posted @ 2012-03-01 15:35 pengyingh 阅读(274) 评论(0) 推荐(0)
上一页 1 ··· 77 78 79 80 81 82 83 84 85 ··· 125 下一页

导航