开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜