请查看我的代码
-(IBAction)clickButton1:(id)sender{
label1.hidden=NO;
button1.userInteractionEnabled = NO;
NSString *sql = [NSString stringWithFormat:@"SELECT * FROM table order by id asc"];
NSArray *all = [datebase selectData:sql columns:71];
index = [all count]-1;
if (index < 0) {
NSLog(@"no");
}
else{
for(i=0;i<=index;i++){
NSArray *row = [all objectAtIndex:i];
NSString *serid = [row objectAtIndex:0];
NSString *logtime = [row objectAtIndex:1];
NSString *post =[NSString stringWithFormat:@"?id=%@&logtime=%@",id,ttime];
NSString *searchTerm = [post stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *hostStr = @"http://www.theurl.com/sy.php";
hostStr = [hostStr stringByAppendingString:searchTerm];
NSData *dataURL = [NSData dataWithContentsOfURL: [NSURL URLWithString: hostStr]];
NSString *serverOutput = [[NSString alloc] initWithData:dataURL encoding: NSUTF8StringEncoding];
if([serverOutput isEqualToString:@"1"]){
if (i==index) {
NSLog(@"success");
}
}
else {
NSLog(@"error");
}
}
}
}
我使用代码,然后单击按钮,但标签仍然是隐藏的,所以对于button1,但如果我只移动代码
-(IBAction)clickButton1:(id)sender{
label1.hidden=NO;
button1.userInteractionEnabled = NO;
}
好的,他们的工作,所以我的代码有什么问题?有谁能够帮我?非常感谢
答案 0 :(得分:0)
USE NSLog(@"bla bla bla")
用于跟踪,如下所示:
-(IBAction)clickButton1:(id)sender {
NSLog(@"bla bla bla")
label1.hidden=NO;
button1.userInteractionEnabled = NO;
}
检查IB中与label1
和button1
的关联。 (出口)