objective c, nsstring to nsarray
Im new to objective C so I need some help, is there any fast way of converting this string:
{{2, 2}, {103, 166}}
to an NSArray
, or just ge开发者_StackOverflow社区tting out the values to four NSInteger
?
This is the storage format of a CGRect
/NSRect
. You can easily read it using CGRectFromString
/NSRectFromString
and then get the values like this:
NSString *string = @"{{2, 2}, {103, 166}}";
CGRect rect = CGRectFromString(string);
CGFloat x = rect.origin.x; // 2
CGFloat y = rect.origin.y; // 2
CGFloat width = rect.size.width; // 103
CGFloat height = rect.size.height; // 166
精彩评论