- 浏览: 1366456 次
- 性别:
- 来自: 开封
文章分类
最新评论
-
用户6006038975:
macd2666 写道录制出来的语音声音好轻啊。你好,这个编译 ...
ios音频录制和播放,文件很小。压缩效果不错 -
用户6006038975:
macd2666 写道录制出来的语音声音好轻啊。
ios音频录制和播放,文件很小。压缩效果不错 -
用户6006038975:
linker command failed with exit ...
ios音频录制和播放,文件很小。压缩效果不错 -
mapboo:
http://www.codertopic.com/?page ...
史上最全的iOS面试题及答案 -
macd2666:
录制出来的语音声音好轻啊。
ios音频录制和播放,文件很小。压缩效果不错
#import "ASIHTTPRequest.h"
#import "ASINetworkQueue.h"
@interface DomainCheckViewController : UIViewController<UITextFieldDelegate,UITableViewDataSource,UITableViewDelegate,ASIHTTPRequestDelegate>
@property(retain,nonatomic)ASINetworkQueue*queCheck;
-(void)sendRequestByQueue
{
//built queue
if (!self.queCheck)
{
self.queCheck=[[ASINetworkQueue alloc]init];
}
self.queCheck.delegate=self;
[queCheck setShouldCancelAllRequestsOnFailure:NO];
//all request use params
NSDictionary *dicDomainName=[NSDictionary dictionaryWithObjectsAndKeys:self.doNameSearch.text,@"domainname", nil];
//get domain state ,domain visit state
NSString*ss1=[NSString stringWithFormat:@"%@_%@1",TOKEN,[self timestamp]];
NSDictionary *paramsState = [NSDictionary dictionaryWithObjectsAndKeys:
dicDomainName,@"data",
@"1.0",@"v",
ss1,@"trid",
@"wwwrecord",@"method",
@"ios",@"client",nil];
NSString*stringState=[NSString stringWithFormat:@"http://hiapp.hichina.com:8080/hiapp/json/wwwrecord/"];
NSURL *urlState = [NSURL URLWithString:stringState];
ASIFormDataRequest*requestState=[ASIFormDataRequest requestWithURL:urlState];
requestState.requestMethod=@"POST";
[requestState setPostValue:paramsState forKey:@"req"];
//get domainname's DNS check
NSString*ss2=[NSString stringWithFormat:@"%@_%@2",TOKEN,[self timestamp]];
NSDictionary *paramsDNS = [NSDictionary dictionaryWithObjectsAndKeys:
dicDomainName,@"data",
@"1.0",@"v",
@"whois",@"method",
ss2,@"trid",
@"ios",@"client",nil];
NSString*stringDNS=[NSString stringWithFormat:@"http://hiapp.hichina.com:8080/hiapp/json/whois/"];
NSURL *urlDNS = [NSURL URLWithString:stringDNS];
ASIFormDataRequest*requestDNS=[[ASIFormDataRequest alloc]initWithURL:urlDNS];
[requestDNS setRequestMethod:@"POST"];
[requestDNS setPostValue:paramsDNS forKey:@"req"];
//get unregistered domainname
NSString*ss3=[NSString stringWithFormat:@"%@_%@3",TOKEN,[self timestamp]];
NSDictionary *paramsUnregis = [NSDictionary dictionaryWithObjectsAndKeys:
dicDomainName,@"data",
@"1.0",@"v",
@"nodomainname",@"method",
ss3,@"trid",
@"ios",@"client",nil];
NSString*stringUnregis=[NSString stringWithFormat:@"http://hiapp.hichina.com:8080/hiapp/json/noDomainName/"];
NSURL *urlUnregis = [NSURL URLWithString:stringUnregis];
ASIFormDataRequest *requestUnregis=[[ASIFormDataRequest alloc]initWithURL:urlUnregis];
[requestUnregis setRequestMethod:@"POST"];
[requestUnregis setPostValue:paramsUnregis forKey:@"req"];//this way set value default POST
//get select domainname
NSDictionary*dic;
if ([self chineseOrEnglish:self.doNameSearch.text])//is english
{
dic=[NSDictionary dictionaryWithObjectsAndKeys:self.doNameSearch.text,@"domainnames", nil];
}
else
{
dic=[NSDictionary dictionaryWithObjectsAndKeys:[self.doNameSearch.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],@"domainnames", nil];
}
NSString*ss4=[NSString stringWithFormat:@"%@_%@4",TOKEN,[self timestamp]];
NSDictionary *paramsSelect = [NSDictionary dictionaryWithObjectsAndKeys:
dic,@"data",
@"1.0",@"v",
@"checkdomain",@"method",
@"news",@"module",
ss4,@"trid",
@"ios",@"client",nil];
NSString*stringSelect=[NSString stringWithFormat:@"http://hiapp.hichina.com/hiapp/json/checkdomain/"];
NSURL *urlSelect = [NSURL URLWithString:stringSelect];
ASIFormDataRequest*requestSelect=[[ASIFormDataRequest alloc]initWithURL:urlSelect];
[requestSelect setPostValue:paramsSelect forKey:@"req"];
//put all request to my queue
[self.queCheck addOperation:requestState];
[self.queCheck addOperation:requestDNS];
[self.queCheck addOperation:requestUnregis];
[self.queCheck addOperation:requestSelect];
//assign all request uinque dictionary
requestState.userInfo=[NSDictionary dictionaryWithObject:@"state" forKey:@"name"];
requestDNS.userInfo=[NSDictionary dictionaryWithObject:@"dns" forKey:@"name"];
requestUnregis.userInfo=[NSDictionary dictionaryWithObject:@"unregis" forKey:@"name"];
requestSelect.userInfo=[NSDictionary dictionaryWithObject:@"select" forKey:@"name"];
//set delegate method finish or fail for queue
[queCheck setRequestDidFinishSelector:@selector(doFinish:)];
[queCheck setRequestDidFailSelector:@selector(doFail:)];
[queCheck setQueueDidFinishSelector:@selector(doAllQueue:)];
[queCheck go];
}
-(void)doFinish:(ASIFormDataRequest*)sender
{
// NSString*requestName=[[sender userInfo] objectForKey:@"name"];
if ([[[sender userInfo] objectForKey:@"name"] isEqualToString:@"state"])//state request data
{
NSMutableString *receiveStr = [[NSMutableString alloc]
initWithData:[sender responseData] encoding:NSUTF8StringEncoding];
NSLog(@"dicsta====%@",receiveStr);
NSDictionary*dicJson=[receiveStr JSONValue];
NSDictionary*dicResault=[dicJson objectForKey:@"results"];
//domain name state
if ([[dicResault objectForKey:@"wwwstatus"] intValue]==1)//normarl
{
[self.domainState setTitle:@"域名状态:正常" forState:UIControlStateNormal];
[self.domainState setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
}
else
{
[self.domainState setTitle:@"域名状态:异常" forState:UIControlStateNormal];
[self.domainState setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
}
//domain name visit state
NSArray*arrVisit=[dicResault objectForKey:@"infos"];
[self.visitDetail setTitle:[dicResault objectForKey:@"infos"] forState:UIControlStateSelected];
[self.domainVisit setTitle:@"域名访问状态:正常" forState:UIControlStateNormal];
[self.domainVisit setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
for (int i=0; i<[arrVisit count]; i++)
{
NSDictionary*dicvisit=[arrVisit objectAtIndex:i];
if ([[dicvisit objectForKey:@"status"] intValue]!=1)//all visit state must be 1
{
[self.domainVisit setTitle:@"域名访问状态:异常" forState:UIControlStateNormal];
[self.domainVisit setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
break;
}
}
}
if ([[[sender userInfo] objectForKey:@"name"] isEqualToString:@"dns"])//DNS request data
{
NSMutableString *receiveStr = [[NSMutableString alloc]
initWithData:[sender responseData] encoding:NSUTF8StringEncoding];
NSLog(@"dicdns====%@",receiveStr);
NSDictionary*dicJson=[receiveStr JSONValue];
NSDictionary*dicResault=[dicJson objectForKey:@"results"];
NSDictionary*dicWhois=[dicResault objectForKey:@"whois"];
[self.stateDetail setTitle:[dicWhois objectForKey:@"domainstatus"] forState:UIControlStateSelected];
[self.DNSDetail setTitle:[dicWhois objectForKey:@"dnsserver"] forState:UIControlStateSelected];
if ([[dicWhois objectForKey:@"dnsserver"] isKindOfClass:[NSString class]])//is nsstring normal
{
[self.domainDNS setTitle:@"域名DNS状态:正常" forState:UIControlStateNormal];
[self.domainDNS setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
}
else
{
[self.domainDNS setTitle:@"域名DNS状态:异常" forState:UIControlStateNormal];
[self.domainDNS setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
}
}
if ([[[sender userInfo] objectForKey:@"name"] isEqualToString:@"unregis"])//unregistered request data
{
NSMutableString *receiveStr = [[NSMutableString alloc]
initWithData:[sender responseData] encoding:NSUTF8StringEncoding];
NSLog(@"dicunresgit====%@",receiveStr);
NSDictionary*dicresault=[[receiveStr JSONValue] objectForKey:@"results"];
NSString*strUnregist=[dicresault objectForKey:@"notdomain"];
NSLog(@"uuuuuuuu======%@",strUnregist);
if ([strUnregist length])
{
[self.domainUnReg setTitle:[NSString stringWithFormat:@"有%d个未注册的域名",[[strUnregist componentsSeparatedByString:@","] count]] forState:UIControlStateNormal];
[self.domainUnReg setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
[self.regDetail setTitle:strUnregist forState:UIControlStateSelected];
}
else
{
[self.domainUnReg setTitle:@"无未注册域名" forState:UIControlStateNormal];
[self.domainUnReg setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
}
}
if ([[[sender userInfo] objectForKey:@"name"] isEqualToString:@"select"])
{
NSMutableString *receiveStr = [[NSMutableString alloc]
initWithData:[sender responseData] encoding:NSUTF8StringEncoding];
NSLog(@"dicselect====%@",receiveStr);
//move down in the screen
[UIView animateWithDuration:0.5 animations:^{
self.domainResault.alpha=1;
self.btuBackImage.frame=CGRectMake(0, 200, 320, 300);
}];
NSDictionary*dicJson=[receiveStr JSONValue];
NSDictionary*dicresault=[dicJson objectForKey:@"results"];
NSArray*arrDomain=[dicresault objectForKey:@"domainnames"];
if ([[[arrDomain objectAtIndex:0] objectForKey:@"status"] intValue]==1)//the domain name have be registed
{
[self.resaultOn setTitle:@"此域名已被注册" forState:UIControlStateNormal];
self.face.image=[UIImage imageNamed:@"018@2x.png"];
[self.btu1 setImage:[UIImage imageNamed:@"detailbutton.png"] forState:UIControlStateNormal];
[self.btu1 setTitle:self.doNameSearch.text forState:UIControlStateSelected];
[self.btu2 setImage:[UIImage imageNamed:@"监控按钮.png"] forState:UIControlStateNormal];
}
else
{
[self.resaultOn setTitle:@"此域名未被注册" forState:UIControlStateNormal];
self.face.image=[UIImage imageNamed:@"smile.png"];
[self.btu1 setImage:[UIImage imageNamed:@"buycar.png"] forState:UIControlStateNormal];
[self.btu2 setImage:[UIImage imageNamed:@"收藏.png"] forState:UIControlStateNormal];
[self.btu2 setTitle:self.doNameSearch.text forState:UIControlStateSelected];
}
}
}
-(void)doFail:(ASIHTTPRequest*)sender
{
NSLog(@"%@",[sender error]);
}
-(void)doAllQueue:(ASINetworkQueue*)sender
{
NSLog(@"all queue finish");
}
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
if (self.englishButton.selected) {
NSString *match =@"^([a-z0-9]+\\.?(?:com|cn|mobi|co|net|so|org|gov|tel|tv|biz|cc|hk|name|info|asia|me)?(?:\\.?(?:cn))?)$";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",match];
if(![predicate evaluateWithObject:textField.text]){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"对不起,您输入的域名格式有误\n请重新输入!\n\n例如:abc/abc.com" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
[alert release];
}
} else {
//[\u4e00-\u9fa5]中文正则表达式
//@".com",@".net",@".tv",@".biz",@".cc",@".公司",@".网络",@".中国"
NSString *match =@"^([a-z0-9]*[\u4e00-\u9fa5]+[a-z0-9]*\\.?(?:com|net|tv|biz|cc|公司|网络|中国)?)$";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",match];
if(![predicate evaluateWithObject:textField.text]){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"对不起,您输入的域名格式有误\n请重新输入!\n\n例如:万网/万网.com" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
[alert release];
}
}
return YES;
}
#import "ASINetworkQueue.h"
@interface DomainCheckViewController : UIViewController<UITextFieldDelegate,UITableViewDataSource,UITableViewDelegate,ASIHTTPRequestDelegate>
@property(retain,nonatomic)ASINetworkQueue*queCheck;
-(void)sendRequestByQueue
{
//built queue
if (!self.queCheck)
{
self.queCheck=[[ASINetworkQueue alloc]init];
}
self.queCheck.delegate=self;
[queCheck setShouldCancelAllRequestsOnFailure:NO];
//all request use params
NSDictionary *dicDomainName=[NSDictionary dictionaryWithObjectsAndKeys:self.doNameSearch.text,@"domainname", nil];
//get domain state ,domain visit state
NSString*ss1=[NSString stringWithFormat:@"%@_%@1",TOKEN,[self timestamp]];
NSDictionary *paramsState = [NSDictionary dictionaryWithObjectsAndKeys:
dicDomainName,@"data",
@"1.0",@"v",
ss1,@"trid",
@"wwwrecord",@"method",
@"ios",@"client",nil];
NSString*stringState=[NSString stringWithFormat:@"http://hiapp.hichina.com:8080/hiapp/json/wwwrecord/"];
NSURL *urlState = [NSURL URLWithString:stringState];
ASIFormDataRequest*requestState=[ASIFormDataRequest requestWithURL:urlState];
requestState.requestMethod=@"POST";
[requestState setPostValue:paramsState forKey:@"req"];
//get domainname's DNS check
NSString*ss2=[NSString stringWithFormat:@"%@_%@2",TOKEN,[self timestamp]];
NSDictionary *paramsDNS = [NSDictionary dictionaryWithObjectsAndKeys:
dicDomainName,@"data",
@"1.0",@"v",
@"whois",@"method",
ss2,@"trid",
@"ios",@"client",nil];
NSString*stringDNS=[NSString stringWithFormat:@"http://hiapp.hichina.com:8080/hiapp/json/whois/"];
NSURL *urlDNS = [NSURL URLWithString:stringDNS];
ASIFormDataRequest*requestDNS=[[ASIFormDataRequest alloc]initWithURL:urlDNS];
[requestDNS setRequestMethod:@"POST"];
[requestDNS setPostValue:paramsDNS forKey:@"req"];
//get unregistered domainname
NSString*ss3=[NSString stringWithFormat:@"%@_%@3",TOKEN,[self timestamp]];
NSDictionary *paramsUnregis = [NSDictionary dictionaryWithObjectsAndKeys:
dicDomainName,@"data",
@"1.0",@"v",
@"nodomainname",@"method",
ss3,@"trid",
@"ios",@"client",nil];
NSString*stringUnregis=[NSString stringWithFormat:@"http://hiapp.hichina.com:8080/hiapp/json/noDomainName/"];
NSURL *urlUnregis = [NSURL URLWithString:stringUnregis];
ASIFormDataRequest *requestUnregis=[[ASIFormDataRequest alloc]initWithURL:urlUnregis];
[requestUnregis setRequestMethod:@"POST"];
[requestUnregis setPostValue:paramsUnregis forKey:@"req"];//this way set value default POST
//get select domainname
NSDictionary*dic;
if ([self chineseOrEnglish:self.doNameSearch.text])//is english
{
dic=[NSDictionary dictionaryWithObjectsAndKeys:self.doNameSearch.text,@"domainnames", nil];
}
else
{
dic=[NSDictionary dictionaryWithObjectsAndKeys:[self.doNameSearch.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],@"domainnames", nil];
}
NSString*ss4=[NSString stringWithFormat:@"%@_%@4",TOKEN,[self timestamp]];
NSDictionary *paramsSelect = [NSDictionary dictionaryWithObjectsAndKeys:
dic,@"data",
@"1.0",@"v",
@"checkdomain",@"method",
@"news",@"module",
ss4,@"trid",
@"ios",@"client",nil];
NSString*stringSelect=[NSString stringWithFormat:@"http://hiapp.hichina.com/hiapp/json/checkdomain/"];
NSURL *urlSelect = [NSURL URLWithString:stringSelect];
ASIFormDataRequest*requestSelect=[[ASIFormDataRequest alloc]initWithURL:urlSelect];
[requestSelect setPostValue:paramsSelect forKey:@"req"];
//put all request to my queue
[self.queCheck addOperation:requestState];
[self.queCheck addOperation:requestDNS];
[self.queCheck addOperation:requestUnregis];
[self.queCheck addOperation:requestSelect];
//assign all request uinque dictionary
requestState.userInfo=[NSDictionary dictionaryWithObject:@"state" forKey:@"name"];
requestDNS.userInfo=[NSDictionary dictionaryWithObject:@"dns" forKey:@"name"];
requestUnregis.userInfo=[NSDictionary dictionaryWithObject:@"unregis" forKey:@"name"];
requestSelect.userInfo=[NSDictionary dictionaryWithObject:@"select" forKey:@"name"];
//set delegate method finish or fail for queue
[queCheck setRequestDidFinishSelector:@selector(doFinish:)];
[queCheck setRequestDidFailSelector:@selector(doFail:)];
[queCheck setQueueDidFinishSelector:@selector(doAllQueue:)];
[queCheck go];
}
-(void)doFinish:(ASIFormDataRequest*)sender
{
// NSString*requestName=[[sender userInfo] objectForKey:@"name"];
if ([[[sender userInfo] objectForKey:@"name"] isEqualToString:@"state"])//state request data
{
NSMutableString *receiveStr = [[NSMutableString alloc]
initWithData:[sender responseData] encoding:NSUTF8StringEncoding];
NSLog(@"dicsta====%@",receiveStr);
NSDictionary*dicJson=[receiveStr JSONValue];
NSDictionary*dicResault=[dicJson objectForKey:@"results"];
//domain name state
if ([[dicResault objectForKey:@"wwwstatus"] intValue]==1)//normarl
{
[self.domainState setTitle:@"域名状态:正常" forState:UIControlStateNormal];
[self.domainState setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
}
else
{
[self.domainState setTitle:@"域名状态:异常" forState:UIControlStateNormal];
[self.domainState setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
}
//domain name visit state
NSArray*arrVisit=[dicResault objectForKey:@"infos"];
[self.visitDetail setTitle:[dicResault objectForKey:@"infos"] forState:UIControlStateSelected];
[self.domainVisit setTitle:@"域名访问状态:正常" forState:UIControlStateNormal];
[self.domainVisit setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
for (int i=0; i<[arrVisit count]; i++)
{
NSDictionary*dicvisit=[arrVisit objectAtIndex:i];
if ([[dicvisit objectForKey:@"status"] intValue]!=1)//all visit state must be 1
{
[self.domainVisit setTitle:@"域名访问状态:异常" forState:UIControlStateNormal];
[self.domainVisit setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
break;
}
}
}
if ([[[sender userInfo] objectForKey:@"name"] isEqualToString:@"dns"])//DNS request data
{
NSMutableString *receiveStr = [[NSMutableString alloc]
initWithData:[sender responseData] encoding:NSUTF8StringEncoding];
NSLog(@"dicdns====%@",receiveStr);
NSDictionary*dicJson=[receiveStr JSONValue];
NSDictionary*dicResault=[dicJson objectForKey:@"results"];
NSDictionary*dicWhois=[dicResault objectForKey:@"whois"];
[self.stateDetail setTitle:[dicWhois objectForKey:@"domainstatus"] forState:UIControlStateSelected];
[self.DNSDetail setTitle:[dicWhois objectForKey:@"dnsserver"] forState:UIControlStateSelected];
if ([[dicWhois objectForKey:@"dnsserver"] isKindOfClass:[NSString class]])//is nsstring normal
{
[self.domainDNS setTitle:@"域名DNS状态:正常" forState:UIControlStateNormal];
[self.domainDNS setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
}
else
{
[self.domainDNS setTitle:@"域名DNS状态:异常" forState:UIControlStateNormal];
[self.domainDNS setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
}
}
if ([[[sender userInfo] objectForKey:@"name"] isEqualToString:@"unregis"])//unregistered request data
{
NSMutableString *receiveStr = [[NSMutableString alloc]
initWithData:[sender responseData] encoding:NSUTF8StringEncoding];
NSLog(@"dicunresgit====%@",receiveStr);
NSDictionary*dicresault=[[receiveStr JSONValue] objectForKey:@"results"];
NSString*strUnregist=[dicresault objectForKey:@"notdomain"];
NSLog(@"uuuuuuuu======%@",strUnregist);
if ([strUnregist length])
{
[self.domainUnReg setTitle:[NSString stringWithFormat:@"有%d个未注册的域名",[[strUnregist componentsSeparatedByString:@","] count]] forState:UIControlStateNormal];
[self.domainUnReg setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
[self.regDetail setTitle:strUnregist forState:UIControlStateSelected];
}
else
{
[self.domainUnReg setTitle:@"无未注册域名" forState:UIControlStateNormal];
[self.domainUnReg setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
}
}
if ([[[sender userInfo] objectForKey:@"name"] isEqualToString:@"select"])
{
NSMutableString *receiveStr = [[NSMutableString alloc]
initWithData:[sender responseData] encoding:NSUTF8StringEncoding];
NSLog(@"dicselect====%@",receiveStr);
//move down in the screen
[UIView animateWithDuration:0.5 animations:^{
self.domainResault.alpha=1;
self.btuBackImage.frame=CGRectMake(0, 200, 320, 300);
}];
NSDictionary*dicJson=[receiveStr JSONValue];
NSDictionary*dicresault=[dicJson objectForKey:@"results"];
NSArray*arrDomain=[dicresault objectForKey:@"domainnames"];
if ([[[arrDomain objectAtIndex:0] objectForKey:@"status"] intValue]==1)//the domain name have be registed
{
[self.resaultOn setTitle:@"此域名已被注册" forState:UIControlStateNormal];
self.face.image=[UIImage imageNamed:@"018@2x.png"];
[self.btu1 setImage:[UIImage imageNamed:@"detailbutton.png"] forState:UIControlStateNormal];
[self.btu1 setTitle:self.doNameSearch.text forState:UIControlStateSelected];
[self.btu2 setImage:[UIImage imageNamed:@"监控按钮.png"] forState:UIControlStateNormal];
}
else
{
[self.resaultOn setTitle:@"此域名未被注册" forState:UIControlStateNormal];
self.face.image=[UIImage imageNamed:@"smile.png"];
[self.btu1 setImage:[UIImage imageNamed:@"buycar.png"] forState:UIControlStateNormal];
[self.btu2 setImage:[UIImage imageNamed:@"收藏.png"] forState:UIControlStateNormal];
[self.btu2 setTitle:self.doNameSearch.text forState:UIControlStateSelected];
}
}
}
-(void)doFail:(ASIHTTPRequest*)sender
{
NSLog(@"%@",[sender error]);
}
-(void)doAllQueue:(ASINetworkQueue*)sender
{
NSLog(@"all queue finish");
}
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
if (self.englishButton.selected) {
NSString *match =@"^([a-z0-9]+\\.?(?:com|cn|mobi|co|net|so|org|gov|tel|tv|biz|cc|hk|name|info|asia|me)?(?:\\.?(?:cn))?)$";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",match];
if(![predicate evaluateWithObject:textField.text]){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"对不起,您输入的域名格式有误\n请重新输入!\n\n例如:abc/abc.com" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
[alert release];
}
} else {
//[\u4e00-\u9fa5]中文正则表达式
//@".com",@".net",@".tv",@".biz",@".cc",@".公司",@".网络",@".中国"
NSString *match =@"^([a-z0-9]*[\u4e00-\u9fa5]+[a-z0-9]*\\.?(?:com|net|tv|biz|cc|公司|网络|中国)?)$";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",match];
if(![predicate evaluateWithObject:textField.text]){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"对不起,您输入的域名格式有误\n请重新输入!\n\n例如:万网/万网.com" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
[alert release];
}
}
return YES;
}
- 万网.zip (8.1 MB)
- 下载次数: 8
发表评论
-
mac 好用的快捷键
2017-02-03 16:38 655快捷键大全:xcode:1.工程导航器:Command+1 ... -
高德导航路线规划返回信息:
2016-09-23 15:38 1250高德导航路线规划返回信息: 2016-09-2 ... -
iOS block 循环引用
2016-08-08 18:36 733@interface ToolDemoViewCo ... -
iOS 证书过期的问题
2016-07-01 22:09 1825IOS证书过期 Apple Worldwid ... -
如何把本地项目上传到github
2016-06-28 09:42 1297转载自 :http://blog.csdn.net/han ... -
swift 开源框架
2016-04-21 15:05 1198必须Mark!43个优秀的Swift开源项目推荐 转 ... -
JavaScript中execCommand命令详解及实例展示
2016-04-09 08:46 1419转自:http://www.abcd9. ... -
js 监听键盘动作
2016-04-09 08:44 1286转载自:http://geelong.javaeye.com ... -
NSTimer
2016-01-30 15:44 884------------------------------ ... -
更改UITextField 的 placeholder的颜色
2016-01-27 21:39 935方式一: _codeTextField.attribute ... -
iOS UIWebView 和网页交互,返回
2016-01-21 15:32 3156- (BOOL)webView:(UIWebView *) ... -
判断scrlloview是否是向下滑动的
2016-01-20 15:54 1277#pragma mark 判断页面是否是向下滑动的 -(v ... -
ReactiveCocoa 学习笔记
2015-12-30 12:19 3047Tip: 自己开发了好玩的APP: 《小明搜索》(App ... -
UICollectionViewFlowLayout 瀑布流
2015-12-24 13:00 1861Tip: 自己开发了好玩的APP: 《小明搜索》 ... -
iOS 类目添加属性 runtime
2015-11-09 10:11 1118给类目添加属性虽然编译的时候不报错,但是,运行的时候, ... -
podspec 发布自己的pods到CocoaPods trunk
2015-11-06 15:31 2724https://github.com/zjjzmw1/ZM ... -
自己写的获取网络图片,不放内存里,包括文件的删除,创建
2015-11-06 11:44 1302// // UIImageView+CacheURL.m ... -
mac 系统升级 后 cocoapods 等命令行不能用
2015-10-16 23:49 1465sudo gem install -n /usr ... -
xcode直接连接真机有时候崩溃,单独运行就不崩溃
2015-10-08 09:34 1352很可能是你的端点的问题。。。把项目中的断点都去掉试试,,如果不 ... -
文本存储自定义对象。
2015-09-22 13:59 828/** * 缓存model 的 ...
相关推荐
- `ASIHTTPRequestDelegate.h`: 委托协议。 - `ASIProgressDelegate.h`: 进度监听协议。 - `ASICacheDelegate.h`: 缓存协议。 - `ASIHTTPRequest.h`: 主要接口类。 - `ASIHTTPRequest.m`: 实现文件。 - `...
为了更复杂的任务管理,如定义下载队列或控制并发数,开发者需要创建自己的`NSOperationQueue`或使用`ASINetworkQueue`。这些高级特性使得ASIHttpRequest库非常适合处理大规模的数据交换和复杂的网络通信场景。 ...
通过实现ASIHTTPRequestDelegate协议,开发者可以监听请求的状态变化,如开始、结束、失败等,并做出相应的处理。 除了基本的HTTP请求功能,ASIHttpRequest还支持文件上传和下载。例如,你可以使用它来上传图片、...
4. **处理响应**:可以监听请求的状态,例如通过实现`ASIHTTPRequestDelegate`中的方法`requestDidFinish:`和`requestDidFail:`来处理成功和失败的情况。 5. **进度反馈**:可以使用`setDownloadProgressDelegate:`...
extension YourViewController: ASIHTTPRequestDelegate { func requestDidFinish(_ request: ASIHTTPRequest) { if let imageData = request.responseData { // 下载成功,处理数据 } } func request(_ ...
- 通过实现`ASIHTTPRequestDelegate`协议的方法,如`requestDidFinish:`和`requestDidFail:`,可以处理成功和失败的响应。 - 使用`appendData:`或`setPostBody:`发送POST请求的数据。 5. **进度追踪**: ...
同时,通过实现`ASIHTTPRequestDelegate`协议,可以监听请求的状态,如成功、失败、取消等。 由于ASIHTTP库已不再更新,开发者现在更倾向于使用AFNetworking或Alamofire等现代网络库,它们提供了更强大的功能和更好...
1. **ASIHTTPRequestDelegate**:定义了ASIHTTPRequest代理可能需要实现的方法,如请求完成、失败等回调。 2. **ASIProgressDelegate**:规定了上传和下载进度委托所需实现的方法,用于监听上传和下载进度。 3. **...
在实际使用中,开发者可以通过继承或扩展ASIHTTPRequest类来自定义行为,或者实现ASIHTTPRequestDelegate协议来监听请求状态,如开始、完成、失败等事件。 ASIHTTPRequest的亮点在于其灵活性和易用性,但也有其局限...
@interface YourViewController () <ASIHTTPRequestDelegate> @end - (void)requestFinished:(ASIHTTPRequest *)request { // 请求成功处理 } - (void)requestFailed:(ASIHTTPRequest *)request { NSError *...
当请求完成时,可以实现`ASIHTTPRequestDelegate`协议的方法来处理响应,例如: ```objective-c - (void)requestFinished:(ASIHTTPRequest *)request { NSString *responseString = [request responseString]; ...
5. **处理响应**:实现`ASIHTTPRequestDelegate`协议中的方法,如`requestDidFinish:`和`requestDidFail:`,以便在请求完成或失败时得到通知。 6. **获取数据**:在请求成功后,可以使用`[request responseData]`...
- **概念**:通过实现ASIHTTPRequestDelegate协议的方法来处理多个请求的结果。 - **示例代码**:实现`requestFinished:`或`requestFailed:`方法。 - **优点**:更灵活地处理请求结果。 ##### 2.6 关于...
@property (weak) id<ASIHTTPRequestDelegate> delegate; ``` #### 三、发送数据 ##### 2.1 发送请求头 可以通过`setRequestHeader`方法添加自定义的请求头。 ```objective-c [request setRequestHeader:@...