我有一个问题让人头疼,我只是创建方法:
-(void) main{
for (int i = 0; i< 100;i++) {
[self getPhoneOfContact:i];
}
}
-(void)getPhoneOfContact:(NSInteger)id_contact {
ABRecordRef record = ABAddressBookGetPersonWithRecordID(addressBook,id_contact);
CFTypeRef ref1;
ref1 = ABRecordCopyValue(record,kABPersonPhoneProperty);
CFRelease(record);
CFRelease(ref1);
}
Run Code Online (Sandbox Code Playgroud)
我认为内存将近似常数,因为我已经复制了释放内存,但实际上它仍然会增加每个循环i; 谁能解释一下这个:(谢谢!
嘿伙计检查此代码(我的自定义键盘):
-(IBAction) updateTextBackSpace:(id)sender
{
if([txtview.text length]>0)
{
NSString *deletedLastCharString = [txtview.text substringToIndex:([txtview.text length]-1)];
[txtview setText:deletedLastCharString];
}
else
{
return nil;
}
}
Run Code Online (Sandbox Code Playgroud)
问题是我无法弄清楚如何更改此代码,以便我可以擦除光标处任何给定行中的任何文本,退格开始从行的末尾擦除.我应该能够擦除(退格) )从光标位置请帮助
你有什么主意吗?为什么XCode编译会给出这个结果?
ld: duplicate symbol _kJSONDeserializerErrorDomain in
/Users/Shared/_BUILDS_/Debug-iphoneos/libLACDLibrary.a(CJSONDeserializer.o)
and /Users/Shared/_BUILDS_/Debug-iphoneos/libLACDLibrary.a(CJSONDeserializer.o)
Run Code Online (Sandbox Code Playgroud) 我已经创建了一个 PLIST。PLIST的结构是这样的
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://10.87.145.105:8080/copy/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>title</key>
<string>Sample</string>
<key>title.short</key>
<string>Sample1</string>
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud)
这在 Mac/iPhone 中不被识别为 plist。如果我删除那个额外的选项卡并进行相同的缩进,它可以在 mac 和 iPhone 中使用。如下所示的缩进是 MAC 或 iPhone 识别该文件所必需的。
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://10.87.145.105:8080/copy/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>title</key>
<string>Sample</string>
<key>title.short</key>
<string>Sample1</string>
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud) 我在模拟器3.1.3版本上测试我的应用程序,运行正常.当它来到模拟器3.2或4.0时,它从一开始就崩溃了:
2010-09-28 18:36:39.957 Angeloni[23268:207] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'This coder requires that replaced objects be returned from initWithCoder:'
*** Call stack at first throw:
(
0 CoreFoundation 0x0268cb99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x027dc40e objc_exception_throw + 47
2 CoreFoundation 0x02645238 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x026451aa +[NSException raise:format:] + 58
4 UIKit 0x005d03fa UINibDecoderDecodeObjectForValue + 2384
5 UIKit 0x005d1179 -[UINibDecoder decodeObjectForKey:] + 398
6 UIKit 0x004f6d77 -[UIRuntimeConnection initWithCoder:] + 212
7 UIKit 0x005d04ca UINibDecoderDecodeObjectForValue …
Run Code Online (Sandbox Code Playgroud) 我需要有关UIPickerView的帮助,在我的应用程序中,我必须在可用的国家/地区显示UIPickerView.如果任何机构已经实施了国家选择器,请分享代码.
谢谢
我在iphone日期选择器中遇到了本地化的问题.我希望日期选择器只用英语显示日期,但现在它需要在iphone设置中设置为该区域的语言.我尝试了各种有用的东西,如下所示.
通过代码设置语言环境
NSLocale* locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_GB"];
[datePicker setLocale:locale];
[datePicker setCalendar:[locale objectForKey:NSLocaleCalendar]];
Run Code Online (Sandbox Code Playgroud)这没用.如果有任何人有好的想法来解决这个问题,请帮忙
我在使用时收到了弃用方法的警告
[buttonLeft setLineBreakMode:UILineBreakModeWordWrap];
Run Code Online (Sandbox Code Playgroud)
这种方法还有其他替代品吗?
mailSubscritionTable.separatorColor = [UIColor blueColor];
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 5;
}
Run Code Online (Sandbox Code Playgroud)
但是,我在这里得到更多的分隔符,我希望只显示5个分隔符.
当我将UIButton的alpha设置为0时,它的行为就像它没有启用一样.我已经检查了,即使按钮确实保持启用状态(虽然不可见(但没有隐藏,我也检查过)),它停止工作.
即使它的alpha为0,有没有办法让它可以点击?
iphone ×8
objective-c ×3
ios4 ×2
uibutton ×2
xcode ×2
cocoa-touch ×1
duplicates ×1
ios ×1
ipad ×1
macos ×1
memory-leaks ×1
plist ×1
static ×1
uidatepicker ×1
uitableview ×1