好吧,我正在從我發現的UiWebView示例製作應用程序。我需要添加一個按鈕,但這個例子的工作方式類似phonegap,所以我想通了,我需要添加按鈕作爲子視圖到窗口,所以然後我得到我的按鈕,並設置它的按下,但是當我有按下它我的應用程序崩潰...任何人都可以幫忙嗎?這裏是我的代碼片段:iPhone編碼按鈕有什麼問題
- (void)webViewDidFinishLoad:(UIWebView *)webView{
myLoadingLabel.hidden = YES;
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
[window addSubview:webView];
//my button
UIButton *playButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
playButton.frame = CGRectMake(122, 394, 76, 76);
[playButton setTitle:@"Play" forState:UIControlStateNormal];
playButton.backgroundColor = [UIColor clearColor];
[playButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal ];
UIImage *buttonImageNormal = [UIImage imageNamed:@"mic.png"];
UIImage *strechableButtonImageNormal = [buttonImageNormal stretchableImageWithLeftCapWidth:12 topCapHeight:0];
[playButton setBackgroundImage:strechableButtonImageNormal forState:UIControlStateNormal];
UIImage *buttonImagePressed = [UIImage imageNamed:@"mic.png"];
UIImage *strechableButtonImagePressed = [buttonImagePressed stretchableImageWithLeftCapWidth:12 topCapHeight:0];
[playButton setBackgroundImage:strechableButtonImagePressed forState:UIControlStateHighlighted];
[playButton addTarget:self action:@selector(playAction:) forControlEvents:UIControlEventTouchUpInside];
[window addSubview:playButton];
}
-(void)playAction {
NSLog(@"Button Pressed!");
}
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIWebView_ExampleAppDelegate playAction:]:
哦,我知道了一個長鏡頭,但我需要的網頁之外的這個按鈕,因爲它需要的時候再次點擊時點擊,然後開始錄製音頻它需要停止錄製和保存,使用system()運行一個命令;然後把從系統命令獲得的數據放入uiwebview中以便使用...所以如果有人知道一些代碼我會很感激,並且它的越獄應用程序,所以系統命令將會好的。謝謝!!!
什麼是崩潰? –
@KevinBallard @KevinBallard這是我的錯誤,'***終止應用程序由於未捕獲的異常'NSInvalidArgumentException',原因:' - [UIWebView_ExampleAppDelegate playAction:]:' –