{"id":603,"date":"2014-08-02T17:47:36","date_gmt":"2014-08-02T09:47:36","guid":{"rendered":"http:\/\/www.yusian.com\/blog\/?p=603"},"modified":"2016-07-15T16:20:21","modified_gmt":"2016-07-15T08:20:21","slug":"%e8%bd%bb%e6%9d%be%e6%90%ad%e5%bb%ba%e6%96%b0%e7%89%b9%e6%80%a7%e7%95%8c%e9%9d%a2%e3%80%81%e5%90%91%e5%af%bc%e9%a1%b5%e8%87%aa%e9%80%82%e5%ba%94%e5%90%84%e7%a7%8d%e5%b1%8f%e5%b9%95%e5%b0%ba%e5%af%b8","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/project\/2014\/08\/02\/174736603.html","title":{"rendered":"\u8f7b\u677e\u642d\u5efa\u65b0\u7279\u6027\u754c\u9762\u3001\u5411\u5bfc\u9875(\u81ea\u9002\u5e94\u5404\u79cd\u5c4f\u5e55\u5c3a\u5bf8)"},"content":{"rendered":"<p><strong>1\u3001\u5e94\u7528\u573a\u666f<\/strong><\/p>\n<p>\u65b0\u8f6f\u4ef6\u5b89\u88c5\u5728\u7b2c\u4e00\u6b21\u6253\u5f00\u65f6\u90fd\u4f1a\u6709\u8be5\u8f6f\u4ef6\u6216\u7248\u672c\u7684\u4ecb\u7ecd\uff0c\u5728iOS\u4e2d\u6700\u7ecf\u5178\u7684\u505a\u6cd5\u662f\u642d\u5efa\u4e00\u4e2aScrollView\u5206\u9875\u5c55\u793a<br \/>\n\u4f46\u8003\u8651\u5230iPhone4\u7cfb\u7edf\u4e0eiPhone5\u7cfb\u7edf\uff0c\u5c4f\u5e55\u9002\u914d\u5982\u4f55\u66f4\u4e3a\u79d1\u5b66\u7b80\u5355\u662f\u4e00\u95e8\u5b66\u95ee\uff0c\u4ee5\u4e0b\u63d0\u4f9b\u4e00\u4e2a\u53c2\u8003<\/p>\n<p><strong>2\u3001\u56fe\u7247\u547d\u540d<\/strong><\/p>\n<p>\u4e00\u822c\u662f\u4e09\u56fe\u7247\uff0cRetina\u5c4f\u4e4b\u524d\u5c4f\u5e55\u4e00\u5957\u3001iPhone4(4S)\u4e00\u5957\u3001iPhone5(5C\/5S)\u4e00\u5957<\/p>\n<pre lang=\"objc\" line=\"1\">  xxx_\u5e8f\u53f7.png         \/\/ iPhone3GS\u53ca\u4ee5\u524d\uff0c\u53ef\u5ffd\u7565\n  xxx_\u5e8f\u53f7@2x.png      \/\/ iPhone4\u53caiPhone4S\n  xxx_\u5e8f\u53f7-568h@2x.png \/\/ iPhone5\u53caiPhone5C\u3001iPhone5S<\/pre>\n<p>\u5982\uff1a<\/p>\n<pre lang=\"objc\" line=\"1\">  new_feature_1.png\n  new_feature_1@2x.png\n  new_feature_1-568h@2x.png\n  new_feature_2.png\n  new_feature_2@2x.png\n  new_feature_2-568h@2x.png\n  new_feature_3.png\n  new_feature_3@2x.png \n  new_feature_3-568h@2x.png<\/pre>\n<p><strong>3\u3001\u6587\u4ef6\u540d\u81ea\u52a8\u8bc6\u522b<\/strong><\/p>\n<p>3.1\u3001\u589e\u52a0\u4e24\u4e2aCategory<!--more--><br \/>\nNSString+SA<\/p>\n<pre lang=\"objc\" line=\"1\">\/\/\n\/\/  NSString+SA.m\n\/\/  SianWeibo\n\/\/\n\/\/  Created by yusian on 14-4-12.\n\/\/  Copyright (c) 2014\u5e74 \u5c0f\u9f99\u867e\u8bba\u575b. All rights reserved.\n\/\/  \u81ea\u5b9a\u4e49\u5b57\u7b26\u4e32\u62fc\u63a5\u65b9\u6cd5\n\n#import \"NSString+SA.h\"\n\n@implementation NSString (SA)\n\n- (NSString *)fileAppend:(NSString *)string\n{\n    \/\/ 1\u3001\u83b7\u53d6\u6587\u4ef6\u6269\u5c55\u540d\n    NSString *ext = [self pathExtension];\n    \n    \/\/ 2\u3001\u53bb\u6389\u6587\u4ef6\u6269\u5c55\u540d\n    NSString *str = [self stringByDeletingPathExtension];\n    \n    \/\/ 3\u3001\u62fc\u63a5\u65b0\u52a0\u5b57\u7b26\u4e32\n    str = [str stringByAppendingString:string];\n    \n    \/\/ 4\u3001\u62fc\u63a5\u6269\u5c55\u540d\n    str = [str stringByAppendingPathExtension:ext];\n    \n    return str;\n\n}\n\n@end<\/pre>\n<p>UIImage+SA<\/p>\n<pre lang=\"objc\" line=\"1\">\/\/\n\/\/  UIImage+SA.m\n\/\/  SianWeibo\n\/\/\n\/\/  Created by yusian on 14-4-11.\n\/\/  Copyright (c) 2014\u5e74 \u5c0f\u9f99\u867e\u8bba\u575b. All rights reserved.\n\/\/  \n\n\/\/ \u5224\u65ad\u662f\u5426\u4e3aiphone5\u7684\u5b8f\n#define isIPhone5 ([UIScreen mainScreen].bounds.size.height == 568)\n#import \"UIImage+SA.h\"\n#import \"NSString+SA.h\"\n\n@implementation UIImage (SA)\n\n+ (UIImage *)fullScreenImage:(NSString *)string\n{\n    \/\/ \u6839\u636e\u5c4f\u5e55\u9ad8\u5ea6\u5224\u65adiphone5\n    if (isIPhone5) {\n        \n        string = [string fileAppend:@\"-568h@2x\"];\n    \n    }\n    return [self imageNamed:string];\n}\n\n\/\/ \u81ea\u52a8\u62c9\u4f38\u56fe\u7247\n+ (UIImage *)resizeImage:(NSString *)imageName\n{\n    UIImage *image = [UIImage imageNamed:imageName];\n    return [image stretchableImageWithLeftCapWidth:5 topCapHeight:5];\n}\n\n@end<\/pre>\n<p><strong>4\u3001\u521b\u5efaScrollView\uff08\u5173\u952e\u4ee3\u7801\uff09<\/strong><\/p>\n<pre lang=\"objc\" line=\"1\">#pragma mark 2.1\u3001\u6dfb\u52a0scrollView\u63a7\u4ef6\n- (UIScrollView *)creatScrollView       \/\/ \u63a7\u4ef6\u7684\u521b\u5efa\u5355\u72ec\u62bd\u8c61\u6210\u65b9\u6cd5\n{\n    \/\/ \u521b\u5efascrollView\u8bbe\u7f6e\u5c3a\u5bf8\u4f4d\u7f6e\u53ca\u76f8\u5173\u5c5e\u6027\n    UIScrollView *scrollView = [[UIScrollView alloc] init];\n    scrollView.frame = self.view.bounds;\n    scrollView.contentSize = CGSizeMake(_size.width * kPicCount, 0);\n    scrollView.pagingEnabled = YES;\n    scrollView.showsHorizontalScrollIndicator = NO;\n    scrollView.delegate = self;\n    \n    \/\/  \u521b\u5efa\u65b0\u7279\u6027\u56fe\u7247\u8bbe\u7f6e\u5c3a\u5bf8\u4f4d\u7f6e\u5e76\u6dfb\u52a0\u5230scrollView\n    for (int i = 0; i &lt; kPicCount; i++) {\n        UIImageView *imageView = [[UIImageView alloc] init];\n        [scrollView addSubview:imageView];\n        NSString *imageName = [NSString stringWithFormat:@\"new_feature_%d.png\", i + 1];\n        imageView.image = [UIImage fullScreenImage:imageName];\n        imageView.frame = CGRectMake(_size.width * i, 0, _size.width, _size.height);\n    }\n    return scrollView;\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u5e94\u7528\u573a\u666f \u65b0\u8f6f\u4ef6\u5b89\u88c5\u5728\u7b2c\u4e00\u6b21\u6253\u5f00\u65f6\u90fd\u4f1a\u6709\u8be5\u8f6f\u4ef6\u6216\u7248\u672c\u7684\u4ecb\u7ecd\uff0c\u5728iOS\u4e2d\u6700\u7ecf\u5178\u7684\u505a\u6cd5\u662f\u642d\u5efa\u4e00\u4e2aScrollView\u5206\u9875\u5c55\u793a \u4f46\u8003\u8651\u5230iPhone4\u7cfb\u7edf\u4e0eiPhone5\u7cfb\u7edf\uff0c\u5c4f\u5e55\u9002\u914d\u5982\u4f55\u66f4\u4e3a\u79d1\u5b66\u7b80\u5355\u662f\u4e00\u95e8\u5b66\u95ee\uff0c\u4ee5\u4e0b\u63d0\u4f9b\u4e00\u4e2a\u53c2\u8003 2\u3001\u56fe\u7247\u547d\u540d \u4e00\u822c\u662f\u4e09\u56fe\u7247\uff0cRetina\u5c4f\u4e4b\u524d\u5c4f\u5e55\u4e00\u5957\u3001iPhone4(4S)\u4e00\u5957\u3001iPhone5(5C\/5S)\u4e00\u5957 xxx_\u5e8f\u53f7.png \/\/ iPhone3GS\u53ca\u4ee5\u524d\uff0c\u53ef\u5ffd\u7565 xxx_\u5e8f\u53f7@2x.png \/\/ iPhone4\u53caiPhone4S xxx_\u5e8f\u53f7-568h@2x.png \/\/ iPhone5\u53caiPhone5C\u3001iPhone5S \u5982\uff1a new_feature_1.png new_feature_1@2x.png new_feature_1-568h@2x.png new_feature_2.png new_feature_2@2x.png new_feature_2-568h@2x.png new_feature_3.png new_feature_3@2x.png new_feature_3-568h@2x.png 3\u3001\u6587\u4ef6\u540d\u81ea\u52a8\u8bc6\u522b 3.1\u3001\u589e\u52a0\u4e24\u4e2aCategory<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[20,17],"class_list":["post-603","post","type-post","status-publish","format-standard","hentry","category-project","tag-basics","tag-skill"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/603","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=603"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/603\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}