我有一個應用程序,加載相機和覆蓋按鈕的火災,重新加載和返回,以及一個PNG,當點火和重新加載按鈕時動畫。如何在加載攝像機視圖時將視圖控制器(它帶有按鈕和圖像的.xib)加載爲覆蓋圖?使用視圖控制器作爲攝像頭覆蓋?
當主屏幕上的一個按鈕被點擊時,我有相機視圖加載,用於打開另一個按鈕和槍圖像的視圖。
以下是我迄今爲止所做的,即加載相機。我有一個單獨的視圖控制器命名PlayViewController,與該接口的廈門國際銀行:
-(IBAction)getCameraPicture:(id)sender {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
PlayViewController* overlay = [[PlayViewController alloc] initWithNibName:@"PlayViewController" bundle:nil];
picker.cameraOverlayView = overlay.view;
[picker setDelegate:overlay];
[self presentModalViewController:picker animated:YES];
} 這是PlayViewController.m:code
#import "PlayViewController.h"
#import "SoundViewController.h"
@interface PlayViewController()
@end
@implementation PlayViewControlleriPad...
`
PlayViewController.h:
@interface PlayViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate>
{
two array declarations...
}
@property (weak, nonatomic) IBOutlet UIButton *reloadButton;
@property (weak, nonatomic) IBOutlet UIButton *fireButton;
@property (weak, nonatomic) IBOutlet UITextField *ammoField;
@property (weak, nonatomic) IBOutlet UIImageView *type;
@end
這樣做會給我一個[picker] setDelegate:overlay]錯誤。如下所示:'將'PlayViewControlleriPad * _strong發送到不兼容類型的參數'id' –
覆蓋層必須實現這些協議。 @interface YourOverlay:UIViewController –
andreamazz
我已經實現了這些協議,它仍然給我警告。除非這兩件事的順序? –