资源简介
本Demo采用富文本结合正则表达式实现UITableVIew上的图文混排及布局,提供超链接、@、$等功能,完全模仿新浪微博的功能,在数据请求上使用了AFJSONRequest,也使用了图片的异步加载,性能良好,值得学习。
代码片段和文件信息
// AFHTTPClient.m
//
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
//
// Permission is hereby granted free of charge to any person obtaining a copy
// of this software and associated documentation files (the “Software“) to deal
// in the Software without restriction including without limitation the rights
// to use copy modify merge publish distribute sublicense and/or sell
// copies of the Software and to permit persons to whom the Software is
// furnished to do so subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR
// IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER
// LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import
#import “AFHTTPClient.h“
#import “AFHTTPRequestOperation.h“
#import
#ifdef _SYSTEMCONFIGURATION_H
#import
#import
#import
#import
#import
#endif
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
#import
#endif
#ifdef _SYSTEMCONFIGURATION_H
NSString * const AFNetworkingReachabilityDidChangeNotification = @“com.alamofire.networking.reachability.change“;
NSString * const AFNetworkingReachabilityNotificationStatusItem = @“AFNetworkingReachabilityNotificationStatusItem“;
typedef SCNetworkReachabilityRef AFNetworkReachabilityRef;
typedef void (^AFNetworkReachabilityStatusBlock)(AFNetworkReachabilityStatus status);
#else
typedef id AFNetworkReachabilityRef;
#endif
typedef void (^AFCompletionBlock)(void);
static NSString * AFbase64EncodedStringFromString(NSString *string) {
NSData *data = [NSData dataWithBytes:[string UTF8String] length:[string lengthOfBytesUsingEncoding:NSUTF8StringEncoding]];
NSUInteger length = [data length];
NSMutableData *mutableData = [NSMutableData dataWithLength:((length + 2) / 3) * 4];
uint8_t *input = (uint8_t *)[data bytes];
uint8_t *output = (uint8_t *)[mutableData mutableBytes];
for (NSUInteger i = 0; i < length; i += 3) {
NSUInteger value = 0;
for (NSUInteger j = i; j < (i + 3); j++) {
value <<= 8;
if (j < length) {
value |= (0xFF & input[j]);
}
}
static uint8_t const kAFbase64EncodingTable[] = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/“;
NSUInteger idx = (i / 3) * 4;
output[idx + 0] = kAFbase64EncodingTable[(value >> 18) & 0x3F];
output[idx + 1] = kAFbase64EncodingTable[(value >> 12) & 0x3F];
out
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-11-05 13:30 WeiBoDemo\
目录 0 2013-11-05 14:17 WeiBoDemo\WeiBoDemo\
文件 38184 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\AFHTTPClient.h
文件 54741 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\AFHTTPClient.m
文件 6407 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\AFHTTPRequestOperation.h
文件 13117 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\AFHTTPRequestOperation.m
文件 5676 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\AFImageRequestOperation.h
文件 9357 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\AFImageRequestOperation.m
文件 3715 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\AFJSONRequestOperation.h
文件 5804 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\AFJSONRequestOperation.m
文件 3768 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\AFNetworkActivityIndicatorManager.h
文件 5616 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\AFNetworkActivityIndicatorManager.m
文件 1727 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\AFNetworking.h
文件 3531 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\AFPropertyListRequestOperation.h
文件 5665 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\AFPropertyListRequestOperation.m
文件 19994 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\AFURLConnectionOperation.h
文件 32158 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\AFURLConnectionOperation.m
文件 5088 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\AFxm
文件 6427 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\AFxm
目录 0 2013-11-05 13:30 WeiBoDemo\WeiBoDemo\ba
文件 1588 2013-11-05 13:30 WeiBoDemo\WeiBoDemo\ba
目录 0 2013-11-05 14:19 __MACOSX\
目录 0 2013-11-05 14:19 __MACOSX\WeiBoDemo\
目录 0 2013-11-05 14:19 __MACOSX\WeiBoDemo\WeiBoDemo\
目录 0 2013-11-05 14:19 __MACOSX\WeiBoDemo\WeiBoDemo\ba
文件 171 2013-11-05 13:30 __MACOSX\WeiBoDemo\WeiBoDemo\ba
文件 359 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\Customob
文件 997 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\Customob
文件 4632 2013-10-11 20:34 WeiBoDemo\WeiBoDemo\emotionImage.plist
目录 0 2013-11-05 13:30 WeiBoDemo\WeiBoDemo\en.lproj\
文件 45 2013-11-05 13:30 WeiBoDemo\WeiBoDemo\en.lproj\InfoPlist.strings
............此处省略148个文件信息
评论
共有 条评论