我遇到了一个问题。我无法想象为什么会发生这种情况,可能你们可以。
我在IB中创建了一个UIBarButtonItem并正确链接了它。设置属性并合成它。一开始我设置禁用btn(viewWillAppear)。 然后我尝试在我的mysql db中添加一个条目:
NSString *URLStr = [NSString stringWithFormat:@"http://www.justfortestingandsoon.com/example.php?entry=%@", myEntry];
URLStr = [URLStr stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSLog(@"URLStr: %@",URLStr);
NSURL *addURL = [NSURL URLWithString:URLStr];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:addURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30.0];
urlConnectionSet = [NSURLConnection connectionWithRequest:urlRequest delegate:self];
在它的“didReceiveData ...”中,我检查返回了哪个值:
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
NSData *myData;
myData = data;
NSString *testString = [[NSString alloc] initWithData:myData encoding:NSASCIIStringEncoding];
NSLog(@"receivedData: %@", testString);
if ([testString isEqualToString:@"ENABLED"]) {
self.notificationBtnDeactivate.enabled = YES;
}
...
我已经调试过了。 self.notificationBtnDeactivate.enabled = YES;被调用但在UI上没有任何明显的变化。
任何想法?
非常感谢!
答案 0 :(得分:1)
我有两个想法: