如何计算目录中的文件?我在类引用中找不到任何相关内容NSFileManager.
我遇到了UIAlertViewDelegate方法- (void)alertViewCancel:(UIAlertView*)alertView在我用取消按钮取消AlertView时没有被调用的问题.
奇怪的是委托方法- (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex工作正常.
有没有人有想法?
在此先感谢
肖恩
- (void)alertViewCancel:(UIAlertView *)alertView
{
if(![self aBooleanMethod])
{
exit(0);
}
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
//some code
}
Run Code Online (Sandbox Code Playgroud)
单击一个按钮时我会调用它:
- (void)ImagePickDone
{
UIAlertView *alertDone = [[UIAlertView alloc]
initWithTitle:@"Done"
message:@"Are u sure?"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles: @"Yes", nil];
[alertDone show];
[alertDone release];
}
Run Code Online (Sandbox Code Playgroud) 我只是想知道是否可以在NSDocumentDirectory中创建一个子文件夹并将数据写入该创建的文件夹,如:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *dirPath =[[paths objectAtIndex:0] stringByAppendingPathComponent:@"TestFolder"];
NSString *filePath =[dirPath stringByAppendingPathComponent:@"testimage.jpg"];
[imageData writeToFile:filePath atomically:YES];
Run Code Online (Sandbox Code Playgroud)
在此先感谢您的支持!
我只是尝试UITableView使用以下代码从a中删除一行:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
}
Run Code Online (Sandbox Code Playgroud)
问题是我的应用程序崩溃了.(GDB:程序收到信号:"EXC_BAD_INSTRUCTION".)有人知道为什么吗?
我遇到了if语句不起作用的问题.在第一个代码行之后,变量包含值"(null)",因为从他的iphone地址簿中选择联系人的用户没有为此联系人设置国家/地区密钥,所以这么好.
但如果我检查变量,它将不会是真的,但值肯定是"(null)"...有人有想法吗?
NSString *country = [NSString [the dict objectForKey:(NSString *)kABPersonAddressCountryKey]];
if(country == @"(null)")
{
country = @"";
}
Run Code Online (Sandbox Code Playgroud)
谢谢提前
肖恩
iphone ×3
objective-c ×2
cocoa ×1
crash ×1
delegates ×1
directory ×1
if-statement ×1
ios ×1
methods ×1
nsdocument ×1
null ×1
row ×1
uialertview ×1
uitableview ×1