1、url中找字段
+(NSString *)jiexi:(NSString *)CS webaddress:(NSString *)webaddress
{
NSError *error;
NSString *regTags=[[NSString alloc] initWithFormat:@"(^|&|\?)+%@=+([^&]*)(&|$)",CS];
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:regTags
options:NSRegularExpressionCaseInsensitive
error:&error];
// 执行匹配的过程
// NSString *webaddress=@"http://wgpc.wzsafety.gov.cn/dd/adb.htm?adc=e12&xx=lkw&dalsjd=12";
NSArray *matches = [regex matchesInString:webaddress
options:0
range:NSMakeRange(0, [webaddress length])];
for (NSTextCheckingResult *match in matches) {
//NSRange matchRange = [match range];
//NSString *tagString = [webaddress substringWithRange:matchRange]; // 整个匹配串
// NSRange r1 = [match rangeAtIndex:1];
// if (!NSEqualRanges(r1, NSMakeRange(NSNotFound, 0))) { // 由时分组1可能没有找到相应的匹配,用这种办法来判断
// //NSString *tagName = [webaddress substringWithRange:r1]; // 分组1所对应的串
// return @"";
// }
NSString *tagValue = [webaddress substringWithRange:[match rangeAtIndex:2]]; // 分组2所对应的串
// NSLog(@"分组2所对应的串:%@
",tagValue);
return tagValue;
}
return @"";
}
2、xml中找字段
NSArray *attributesArray = authResponse.attributes;
for (DDXMLNode *node in attributesArray) {
NSLog(@"%@",node);
NSLog(@"%@",node.stringValue);
NSLog(@"%@",node.name);
}
3.ios UI设计
http://wenku.baidu.com/link?url=PDnG-gCFPj93s-0ttuV-BIpYOkTHTGMffod-CNU_dZdgRfkIWhJOGN5gGJ7NAC-nJbKhcl5Q8mQRkMedH_ZUO5oZYf-KZy_HUZrF7oA8nZ_
http://appsearch.m.sogou.com/i/Lz6UkynLhFs?from=timeline&isappinstalled=0