iPhone – Set a value from nsDictionary for cgrect.frame.size

I generate a dictionary from a JSON string, and the value of one of the dictionary is intended to be used as the height of the WebView object.

NSDictionary *dic = [jsonParser objectWithString:response];
CGFloat *height = [dic valueForKey:@"intHeightPixels"];
CGRect frame = webView.frame;
frame.size.height = height;
webView.frame = frame;

In line 2, I receive the following error:

Initializing ‘CGFloat’ (aka float) with an expression of incompatible type’id’.

I am a newbie in Objective C. I don’t know what is there to look at pointers, casting, please Give me some highlights.

You may want to try CGFloat * height = [[dic valueForKey:@” intHeightPixels”] floatValue]; There are only objects in the dictionary (here NSNumber)

I generate a dictionary from a JSON string, and the value of one of the dictionary is intended to be used as the height of the WebView object.

NSDictionary *dic = [jsonParser objectWithString:response];
CGFloat *height = [dic valueForKey:@"intHeightPixels"];
CGRect frame = webView.frame;
frame.size.height = height;
webView.frame = frame;

In line 2, I receive the following error Error:

Initializing’CGFloat’ (aka float) with an expression of incompatible type’id’.

I am Newbie in Objective C I don’t know what is there to look at pointers, casting, please give me some highlights.

You may want to try CGFloat * height = [[dic valueForKey:@”intHeightPixels”] floatValue]; There are only objects in the dictionary (here NSNumber)

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1058 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.