{"id":562,"date":"2018-02-23T23:40:03","date_gmt":"2018-02-23T15:40:03","guid":{"rendered":"http:\/\/60.205.208.74\/2018\/02\/23\/ios%e6%a0%87%e7%ad%be\/"},"modified":"2018-02-23T23:40:03","modified_gmt":"2018-02-23T15:40:03","slug":"ios%e6%a0%87%e7%ad%be","status":"publish","type":"post","link":"https:\/\/www.puzi7.net\/?p=562","title":{"rendered":"iOS\u6807\u7b7e"},"content":{"rendered":"<span itemprop=\"description\"><div class=\"article-body\">\n<div class=\"article-intro\" id=\"content\">\n<h2>\u6807\u7b7e\u7684\u4f7f\u7528<\/h2>\n<p>\u6807\u7b7e\u7528\u4e8e\u663e\u793a\u9759\u6001\u5185\u5bb9\uff0c\u5305\u62ec\u5355\u72ec\u7684\u4e00\u884c\u6216\u591a\u884c\u3002<\/p>\n<p>\u91cd\u8981\u7684\u5c5e\u6027<\/p>\n<ul>\n<li>textAlignment<\/li>\n<li>textColor<\/li>\n<li>text<\/li>\n<li>numberOflines<\/li>\n<li>lineBreakMode<\/li>\n<\/ul>\n<h2>\u6dfb\u52a0\u81ea\u5b9a\u4e49\u65b9\u6cd5\u00a0addLabel<\/h2>\n<pre>-(void)addLabel{\n    UILabel *aLabel = [[UILabel alloc]initWithFrame:\n    CGRectMake(20, 200, 280, 80)];\n    aLabel.numberOfLines = 0;\n    aLabel.textColor = [UIColor blueColor];\n    aLabel.backgroundColor = [UIColor clearColor];\n    aLabel.textAlignment = UITextAlignmentCenter;\n    aLabel.text = @\"This is a sample text\\n of multiple lines.\n    here number of lines is not limited.\";\n    [self.view addSubview:aLabel];\n}<\/pre>\n<p>\u5728\u00a0ViewController.m\u00a0\u4e2d\u66f4\u65b0\u00a0viewDidLoad\uff0c\u5982\u4e0b\u6240\u793a:<\/p>\n<pre>- (void)viewDidLoad\n{\n    [super viewDidLoad];\n    \/\/The custom method to create our label is called\n    [self addLabel];\n    \/\/ Do any additional setup after loading the view, typically from a nib.\n}<\/pre>\n<h2>\u8f93\u51fa<\/h2>\n<p>\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\uff0c\u5c31\u4f1a\u5f97\u5230\u4e0b\u9762\u7684\u8f93\u51fa:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"attachment-full\" alt=\"labelOutput\" src=\"http:\/\/www.runoob.com\/wp-content\/uploads\/2013\/11\/labelOutput.jpg\" width=\"146\" height=\"278\" data-pinit=\"registered\"><\/p>\n<\/p><\/div>\n<\/p><\/div>\n<span>","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\"><span itemprop=\"description\">\u6807\u7b7e\u7684\u4f7f\u7528 \u6807\u7b7e\u7528\u4e8e\u663e\u793a\u9759\u6001\u5185\u5bb9\uff0c\u5305\u62ec\u5355\u72ec\u7684\u4e00\u884c\u6216\u591a\u884c\u3002 \u91cd\u8981\u7684\u5c5e\u6027 textAlignm&hellip;<\/span><\/p>\n<p class=\"more-link-p btn-align-right\"><a class=\"green zoom-btn\" href=\"https:\/\/www.puzi7.net\/?p=562\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38,26],"tags":[74,93],"class_list":["post-562","post","type-post","status-publish","format-standard","hentry","category-ios","category-mobile","tag-ios","tag-mobile","zoom-theme-has-thumb"],"_links":{"self":[{"href":"https:\/\/www.puzi7.net\/index.php?rest_route=\/wp\/v2\/posts\/562","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.puzi7.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.puzi7.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=562"}],"version-history":[{"count":0,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=\/wp\/v2\/posts\/562\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.puzi7.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=562"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=562"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}