IOS notes: Tips and ios notes

Source: Internet
Author: User

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"];
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.