{"id":1683,"date":"2015-02-03T17:27:15","date_gmt":"2015-02-03T13:27:15","guid":{"rendered":"http:\/\/ilya2606.ru\/?p=1683"},"modified":"2015-02-03T17:59:07","modified_gmt":"2015-02-03T13:59:07","slug":"%d0%b8%d1%81%d0%bf%d0%be%d0%bb%d1%8c%d0%b7%d1%83%d0%b5%d0%bc-html-%d1%82%d0%b5%d0%ba%d1%81%d1%82-%d0%b2-uilabel","status":"publish","type":"post","link":"http:\/\/ilya2606.ru\/?p=1683","title":{"rendered":"\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c HTML-\u0442\u0435\u043a\u0441\u0442 \u0432 UILabel"},"content":{"rendered":"<p><a href=\"http:\/\/ilya2606.ru\/wp-content\/uploads\/2015\/02\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-2015-02-03-\u0432-16.26.43.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-1684\" src=\"http:\/\/ilya2606.ru\/wp-content\/uploads\/2015\/02\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-2015-02-03-\u0432-16.26.43-300x191.png\" alt=\"DPHTML\" width=\"300\" height=\"191\" srcset=\"http:\/\/ilya2606.ru\/wp-content\/uploads\/2015\/02\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-2015-02-03-\u0432-16.26.43-300x191.png 300w, http:\/\/ilya2606.ru\/wp-content\/uploads\/2015\/02\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-2015-02-03-\u0432-16.26.43-900x573.png 900w, http:\/\/ilya2606.ru\/wp-content\/uploads\/2015\/02\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-2015-02-03-\u0432-16.26.43.png 964w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u043f\u043e\u0432\u0435\u0434\u0430\u044e \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c\u00a0HTML-\u0442\u0435\u043a\u0441\u0442 \u0432 UILabel, \u0430 \u043d\u0435 \u0432 UIWebView, \u043a\u0430\u043a \u043c\u044b \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0440\u0430\u043d\u044c\u0448\u0435.<\/p>\n<p><!--more--><\/p>\n<p>\u0415\u0449\u0435 \u0432 iOS SDK 6.0 \u0432 UILabel\u00a0\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 attributedText, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u0442\u0438\u043b\u0438 \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>\u041d\u043e \u043a\u0430\u043a\u00a0\u0431\u044b\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c HTML-\u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c UILabel?<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043d\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0432 \u043a\u043b\u0430\u0441\u0441 NSAttributedString \u0432 iOS SDK 7.0, \u043c\u0435\u0442\u043e\u0434:<\/p>\n<pre>- (instancetype)initWithData:(NSData *)data options:(NSDictionary *)options documentAttributes:(NSDictionary **)dict error:(NSError **)error<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0421 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u00a0NSAttributedString, \u0441\u0442\u0438\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434 HTML.<\/p>\n<p>\u041a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c?<\/p>\n<p>&nbsp;<\/p>\n<pre>\/\/\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c\u00a0HTML-\u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0434\u0430\u0442\u0443 \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u043e\u0439.\u00a0\u0414\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0446\u044b \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c NSUnicodeStringEncoding\r\nNSData *data = [html dataUsingEncoding:NSUnicodeStringEncoding];\r\n\r\n\/\/\u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043e\u043f\u0446\u0438\u0439\r\nNSDictionary *options = @{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType};\r\n\r\n\/\/\u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u00a0NSAttributedString\r\nNSAttributedString *attributedString = [[NSAttributedString alloc] initWithData:data options:options documentAttributes: nil error: nil];\r\n\r\n\/\/\u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0441\u0442\u0438\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043a \u043b\u0435\u0439\u0431\u043b\u0443\r\nlabel.attributedText = attributedString;\r\n<\/pre>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e \u0434\u043b\u044f UILabel, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043d\u0430 <a href=\"https:\/\/github.com\/ILYA2606\/UILabel-DPHTML\">GitHub<\/a> \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e\u043c.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><div align=\"right\"><div class=\"sharexyWidgetNoindexUniqueClassName\"><div id=\"shr_65942789\"><\/div><\/div><\/div><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>&nbsp; \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u043f\u043e\u0432\u0435\u0434\u0430\u044e \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c\u00a0HTML-\u0442\u0435\u043a\u0441\u0442 \u0432 UILabel, \u0430 \u043d\u0435 \u0432 UIWebView, \u043a\u0430\u043a \u043c\u044b \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0440\u0430\u043d\u044c\u0448\u0435.<\/p>\n<div align=\"right\">\n<div class=\"sharexyWidgetNoindexUniqueClassName\">\n<div id=\"shr_65942789\"><\/div>\n<\/div>\n<\/div>\n<p><!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,6],"tags":[164,167,163,210,166,162,165],"_links":{"self":[{"href":"http:\/\/ilya2606.ru\/index.php?rest_route=\/wp\/v2\/posts\/1683"}],"collection":[{"href":"http:\/\/ilya2606.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ilya2606.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ilya2606.ru\/index.php?rest_route=\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"http:\/\/ilya2606.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1683"}],"version-history":[{"count":5,"href":"http:\/\/ilya2606.ru\/index.php?rest_route=\/wp\/v2\/posts\/1683\/revisions"}],"predecessor-version":[{"id":1689,"href":"http:\/\/ilya2606.ru\/index.php?rest_route=\/wp\/v2\/posts\/1683\/revisions\/1689"}],"wp:attachment":[{"href":"http:\/\/ilya2606.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ilya2606.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1683"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ilya2606.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}