【发布时间】:2012-09-01 06:50:01
【问题描述】:
我有一个应用程序,它可以加载相机并覆盖开火、重新加载和返回按钮,以及一个在点击开火和重新加载按钮时动画的 png。当相机视图加载时,我将如何加载视图控制器,它有一个带有按钮和图像的 .xib 作为覆盖?
当点击主屏幕上的按钮时,我会加载相机视图,该按钮用于打开另一个带有按钮和枪图像的视图。
以下是我到目前为止所做的,即加载相机。我有一个名为 PlayViewController 的单独视图控制器,接口有一个 xib:
-(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
【问题讨论】:
标签: iphone objective-c ios xcode ipad