查看控制器故障

时间:2013-10-05 10:14:24

标签: ios objective-c uiviewcontroller

我正在制作音乐流媒体应用,但我似乎只能将控件添加到默认视图控制器这是我的ViewController.h代码

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController {
    IBOutlet UIWebView *WebView;
}

-(IBAction)Play:(id)sender;

@end

这是我的viewcontrol.m代码

-(IBAction)Play:(id)sender{

    NSString *stream = @"http://117.53.175.113:15008/listen.pls";

    NSURL *url = [NSURL URLWithString:stream];

    NSURLRequest *urlrequest = [NSURLRequest requestWithURL:url];

    [WebView loadRequest:urlrequest];
}


@end

请帮忙

1 个答案:

答案 0 :(得分:0)

IBOutlet从界面构建器拖到外部类括号{}。

类似的东西:

@interface ViewController : UIViewController {
    IBOutlet UIWebView *WebView; // remove this.
}
@property (unsafe_unretained, nonatomic) IBOutlet UIWebView * WebView;