嗨,我很新開發iOS應用程序,請幫助我。我正在使用UIImagePicker
捕獲圖像時遇到問題。我已經將臀部暴徒應用程序整合到我們的應用程序中捕捉圖像無法正常工作。?
在那個窗口中,我想顯示一個UIButton
,以便用戶點擊那個UIButton
應該捕捉圖像。當我點擊按鈕時,它會拋出一條消息(其視圖不在窗口層次中!)。
我認爲這是由於這個聊天窗口。這裏是我的代碼片段。
[[HMService sharedService] openChat:self withSetup:^(HMChatViewController * controller)
{
controller.chatDelegate = self;
controller.chatView.receivedMessageFont = [UIFont systemFontOfSize:20.0];
controller.navigationBarHidden = YES;
UIView * viewObjForVehicleDetails = [[UIView alloc]init];
UIButton * btnForCaputrePhoto = [[UIButton alloc]init];
[btnForCaputrePhoto addTarget:self action:@selector(CapturePhotoImage) forControlEvents:UIControlEventTouchUpInside];
btnForCaputrePhoto.frame = CGRectMake(55, 90, 103, 85);
[controller.chatView addSubview:viewObjForVehicleDetails];
[viewObjForVehicleDetails addSubview:btnForCaputrePhoto];
[[controller.chatView table] registerClass:[ChatTableViewCell class] forCellReuseIdentifier:@"ReuseChatTableViewCell"];
}
-(void)CapturePhotoImage
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:picker animated:NO completion:nil];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[picker dismissViewControllerAnimated:YES completion:NULL];
}
在此先感謝。
是圖片選擇器顯示?或它正在崩潰 – Vizllx
謝謝你的回覆..!沒有它沒有顯示圖像選擇器,我在設備上測試過,所以它不會崩潰。我認爲我使用hipmob控制器,我添加按鈕,所以它不導航imagePickerView –
你被添加self.view添加子視圖viewObjForVehicleDetails –