1.首先对项目添加相关库文件:

2.头文件中添加相关引用和变量:
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import <AVKit/AVKit.h>
#import <MessageUI/MessageUI.h>
@interface ViewController : UIViewController<MFMailComposeViewControllerDelegate, UIImagePickerControllerDelegate>{
AVAudioPlayer *audioPlayer;
AVPlayerViewController *avPlayerView;
MFMailComposeViewController *mailView;
UIImagePickerController *imagePicker;
IBOutlet UIImageView *mImageView;
}
@end
- 相机,在main.storyboard中添加一按钮启动相机,action代码如下:
- (IBAction)openCamera:(id)sender {
imagePicker = [[UIImagePickerController alloc]init];
if(!imagePicker) {
NSLog(@"No camera APP in your device.");
return;
}
imagePicker.allowsEditing = YES;
imagePicker.delegate = self;
if<

这篇博客介绍了在iOS应用中使用Objective-C进行多媒体开发的方法,包括如何添加相关库文件、启动相机、实现邮件功能以及播放音频和视频文件。详细讲述了在main.storyboard中设置按钮启动相机,并通过代码实现邮件发送。同时,提到了播放多媒体文件的实现方式。
最低0.47元/天 解锁文章
805

被折叠的 条评论
为什么被折叠?



