iphone之NSString, char, NSData相互转化
NSString *strNSString
const char *pConstChar;
strNSString = [[NSString alloc] initWithUTF8String:pConstChar];
pConstChar = [strNSString UTF8String];
iphone之NSString, char, NSData相互转化
NSString *strNSString
const char *pConstChar;
strNSString = [[NSString alloc] initWithUTF8String:pConstChar];
pConstChar = [strNSString UTF8String];
iphone中按Home键退出程序
(2012-01-06 15:58:01)
折磨人的两个小问题
(2011-12-13 21:01:50)
int i = 2;
NSLog(@"Selected index:%@",i);
结果:Selected index(null)或者直接crash
解决方法:NSLog(@"Selected index:%i",i);
NO.2
cellForRowAtIndexPath中
for (UIButton *view in subviews) {
forControlEvents:UIControlEventTouchUpIns
}
-(IBAction)filterSelected:(id)sender
{
}
结果:sender为空(0x0)
原因:view已经被销毁
解决方法:view设成property
补充(NO.2):
CGRect frame =CGRectMake(i*62,line*62,52, 52);
UIButton *btn = [[UIButton alloc] initWithFrame:frame];
[btn setTitle:[NSString stringWithFormat:@"%d", line*numperLine +i]forState:UIControlStateNormal];
这又是正常的
从NIB加载时属性为空的问题
(2011-12-12 00:32:52)//试试看这个。。。
int rowToHighlight = [[userDefaults valueForKey:@"content_row"] intValue];
NSIndexPath * ndxPath= [NSIndexPath indexPathForRow:rowToHighlight inSection:0];
[contentTableView scrollToRowAtIndexPath:ndxPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
Crash with SBJSON library
用了1个多小时解决了这个问题。记录一下,做静态库的时候应该很常见。
http://stackoverflow.com/questions/7854785/crash-with-sbjson-library
http://stackoverflow.com/questions/9462259/adding-spview-to-an-existing-ios-project-just-show-pink-screen-sparrow-framewor