看不見我不得不隱藏的UIView的UIWebView的onload事件,並說明它被點擊一個的UIButton只有當......我試試這個:如何使一個UIWebView在Objective-C
在.hi創建IBOutlet中對應於xib。
#import <UIKit/UIKit.h>
@interface SingleViewController : UIViewController{
UIWebView *gif;
UIButton *go;
}
@property(nonatomic,retain) IBOutlet UIWebView *gif;
@property(nonatomic,retain) IBOutlet UIButton *go;
@end
在.M我試圖隱藏的UIWebView以這樣的方式
@implementation SingleViewController
@synthesize sug;
@synthesize gif;
@synthesize avvia;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
gif.hidden=YES;
UIImage *keys = [UIImage imageNamed:@"chiave.png"];
[self.go setImage:chiave forState:UIControlStateNormal];
[self.go setImage:chiave forState:UIControlStateHighlighted];
[self.go setImage:chiave forState:UIControlStateDisabled];
[self.go setImage:chiave forState:UIControlStateSelected];
}
return self;
}
,我以這種方式加載此的UIView:
SingleViewController *single = [[SingleViewController alloc]initWithNibName:@"SingleViewController" bundle:nil];
[self.view addSubview:single.view];
錯在何處?
把'gif.hidden = YES;'放入'loadView'或'viewDidLoad'方法 – beryllium