IOS notes: Tips and ios notes
Calculates the cell height. In the custom cell
-(Void) resizeTheHeight
{
CGFloat contentWidth = 280;
UIFont * font = [UIFont fontWithName: @ "Arial" size: 14];
CGSize size = [txtContent. text sizeWithFont: font constrainedToSize: CGSizeMake (contentWidth, 220) lineBreakMode: UILineBreakModeTailTruncation];
[TxtContent setFrame: CGRectMake (20, 28,280, size. height)];
[CenterimageView setFrame: CGRectMake (0, 0,320, size. height + 30)];
[FootView setFrame: CGRectMake (5, size. height + 28,310, 2)];
}
Id image = [dictionary objectForKey: @ "image"];
If (NSNull *) image! = [NSNull null]) // determines whether it is null.
{
Self. imageURL = [dictionary objectForKey: @ "image"];
NSString * newImageURL = [NSString stringWithFormat: @ "http://img.qiushibaike.com/system/pictures/%@/small/%@", qiushiID, imageURL];
NSString * newImageMidURL = [NSString stringWithFormat: @ "http://img.qiushibaike.com/system/pictures/%@/medium/%@", qiushiID, imageURL];
Self. imageURL = newImageURL;
Self. imageMidURL = newImageMidURL;
}
NSDictionary * vote = [NSDictionary dictionaryWithDictionary: [dictionary objectForKey: @ "votes"];
Self. downCount = [[vote objectForKey: @ "down"] intValue];
Self. upCount = [[vote objectForKey: @ "up"] intValue];
Id user = [dictionary objectForKey: @ "user"];
If (NSNull *) user! = [NSNull null])
{
NSDictionary * user = [NSDictionary dictionaryWithDictionary: [dictionary objectForKey: @ "user"];
Self. anchor = [user objectForKey: @ "login"];
}