Xcode 版本:4.2和4.2之前的版本
选中需要格式化代码 -> Edit -> Format ->Re-Indent
Xcode 版本:4.2之后的版本
选中需要格式化代码 -> Editor -> Structure ->Re-Indent 或者
选中需要格式化代码 -> 右击 ->选中 Structure ->Re-Indent

<Application_Home>
/Documents/ |
您应该将所有的应用程序数据文件写入到这个目录下。这个目录用于存储用户数据或其它应该定期备份的信息。有关如何取得这个目录路径的信息,请参见“获取应用程序目录的路径”部分。
iTunes会备份这个目录的内容。
|
<Application_Home>
/Library/Preferences |
这个目录包含应用程序的偏好设置文件。您不应该直接创建偏好设置文件,而是应该使用
NSUserDefaults类或CFPreferences API来取得和设置应用程序的偏好,详情请参见“添加Settings程序包”部分。
iTunes会备份这个目录的内容。
|
public static boolean isNumeric(String str){
try {
Integer.parseInt(str);
return true;
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
return false;
}
}
1 2 3 4 5 | typedef struct _NSRange { NSUInteger location; NSUInteger length; } NSRange; |
1 2 3 4 5 | #if __LP64__ || TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64 typedef unsigned long NSUInteger; #else typedef unsigned int NSUInteger; #endif |
1 2 3 4 5 6 7 8 9 | NSString *homebrew = @"Imperial India Pale Ale (IPA)"; // Starting at position 25, get 3 characters NSRange range = NSMakeRange (25, 3); // This would also work: // NSRange range = {25, 3}; NSLog (@"Beer shortname: %@", [homebrew substringWithRange:range]); |
1 2 3 4 5 6 | NSString *homebrew = @"Imperial India Pale Ale (IPA)"; NSRange range = [homebrew rangeOfString:@"IPA"]; // Did we find the string "IPA" ? if (range.length > 0) NSLog(@"Range is: %@", NSStringFromRange(range)); |
1 2 3 4 5 6 7 8 | NSString *homebrew = @"Imperial India Pale Ale (IPA)"; // Search for the "ia" starting at the end of string NSRange range = [homebrew rangeOfString:@"ia" options:NSBackwardsSearch]; // What did we find if (range.length > 0) NSLog(@"Range is: %@", NSStringFromRange(range)); |
1 2 3 4 | Declaration: typedef struct _NSRange { NSUInteger location; NSUInteger length; } NSRange; |
1 2 3 4 | Declaration: NSRange NSMakeRange ( NSUInteger loc, NSUInteger len ); |
1 2 | NSRange range = NSMakeRange(0, 5); NSArray *subArray = [self.states subarrayWithRange:range]; |