ios设计一部WindowsPhone手机
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了ios设计一部WindowsPhone手机,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含4070字,纯文字阅读大概需要6分钟。
内容图文
![ios设计一部WindowsPhone手机](/upload/InfoBanner/zyjiaocheng/1132/f9195cc92e654e85a02d163790b7ca60.jpg)
ios设计一部WindowsPhone手机
main.m
#import <Foundation/Foundation.h> #import "WindowsPhone.h" int main(int argc, const char * argv[]) { WindowsPhone * phone = [WindowsPhone new]; phone->_color = WindowsPhoneColorGolden; phone->_size = 3.5; NSLog(@"%@",phone); [phone cameraWithFlashLightSatuts:WindowsPhoneFlashLightStatusOpen]; @autoreleasepool { // insert code here... //NSLog(@"Hello, World!"); } return 0; }
WindowsPhone.h
#import <Foundation/Foundation.h> enum WindowsPhoneSize { WindowsPhoneSize3Point5,//屏幕尺寸3.5 WindowsPhoneSize4Point0,//屏幕尺寸4.0 WindowsPhoneSize5Point5,//屏幕尺寸5.5 WindowsPhoneSize6Point0 //屏幕尺寸6.5 }; typedef enum WindowsPhoneSize WindowsPhoneSize; enum WindowsPhoneColor { WindowsPhoneColorWhite,//用来存储WidowsPhone的颜色白色 WindowsPhoneColorGolden,//用来存储WindowsPhone的颜色土豪金 WindowsPhoneColorBlack //用来存储WindowsPhone的颜色黑色 }; typedef enum WindowsPhoneColor WindowsPhoneColor; enum WindowsPhoneFlashLightStatus { WindowsPhoneFlashLightStatusOpen,//闪关灯开 WindowsPhoneFlashLightStatusClose,//闪光灯关 WindowsPhoneFlashLightStatusAuto//自动模式 }; typedef enum WindowsPhoneFlashLightStatus WindowsPhoneFlashLightStatus; //记录电影播放的状态 enum WindowsPhoneFilmPlayStatus { WindowsPhoneFilmPlayStatusStart,//状态:开始播放 WindowsPhoneFilmPlayStatusPause,//状态:暂停播放 WindowsPhoneFilmPlayStatusFastSpeed,//状态:快进 WindowsPhoneFilmPlayStatusSlowSpeed, //状态:快退 WindowsPhoneFilmPlayStatusLastFilm,//状态:上一部 WindowsPhoneFilmPlayStatusNextFilm //状态:下一部 }; typedef enum WindowsPhoneFilmPlayStatus WindowsPhoneFilmPlayStatus; @interface WindowsPhone : NSObject { @public /**用来存储WindowsPhone的颜色*/ WindowsPhoneColor _color; /**用来存储WindowsPhone的尺寸大小*/ float _size; /**用来存储WindowsPhone cpu的大小*/ float _cpu; /**用来存储WindowsPhone ram内部存储的大小*/ float _ram; } //setter 方法 -(void)setWindowsPhoneSize:(float)size; /**打开闪光灯*/ -(void)openFlashLight; /**关闭闪光灯*/ -(void)closeFlashLight; /**自动模式*/ -(void)flaseLightAuto; /**拍照*/ -(void)cameraWithFlashLightSatuts:(WindowsPhoneFlashLightStatus)flashLightStatus; /**看电影*/ -(void)filmWithPlayStatus:(WindowsPhoneFilmPlayStatus)WindowsPhoneFilmPlayStatus; /**发邮件*/ -(void)sendEmail; @end
WindowsPhone.m
#import "WindowsPhone.h" @implementation WindowsPhone /**打开闪光灯*/ -(void)openFlashLight { //打开闪光灯 NSLog(@"打开闪光灯"); } /**关闭闪光灯*/ -(void)closeFlashLight { //关闭闪光灯 NSLog(@"关闭闪光灯"); } /**自动模式*/ -(void)flaseLightAuto { //自动模式 NSLog(@"自动模式"); } //拍照 -(void)cameraWithFlashLightSatuts:(WindowsPhoneFlashLightStatus)flashLightStatus { //self 关键字 谁调用指的就是谁 可以实现类的内部方法的调用 if(flashLightStatus == WindowsPhoneFlashLightStatusOpen) { [self openFlashLight]; //打开摄像头 } else if(flashLightStatus==WindowsPhoneFlashLightStatusClose) { [self closeFlashLight]; //关闭摄像头 } else { [self flaseLightAuto]; //自动模式 } NSLog(@"拍照了!笑一个!"); //用switch来实现这个功能 /* switch(flashLightStatus) { case WindowsPhoneFlashLightStatusOpen: [self openFlashLight]; break; case WindowsPhoneFlashLightStatusClose: [self closeFlashLight]; break; case WindowsPhoneFlashLightStatusAuto: [self flaseLightAuto]; break; default: break; } */ } //看电影 -(void)filmWithPlayStatus:(WindowsPhoneFilmPlayStatus)WindowsPhoneFilmPlayStatus { if(WindowsPhoneFilmPlayStatus == WindowsPhoneFilmPlayStatusStart){ //开始播放电影 NSLog(@"开始播放电影"); } else if (WindowsPhoneFilmPlayStatus == WindowsPhoneFilmPlayStatusPause) { //暂停播放 NSLog(@"暂停播放"); } else if(WindowsPhoneFilmPlayStatus == WindowsPhoneFilmPlayStatusFastSpeed) { //快进 NSLog(@"快进"); } else if(WindowsPhoneFilmPlayStatus == WindowsPhoneFilmPlayStatusSlowSpeed) { //快退 NSLog(@"快退"); } else if(WindowsPhoneFilmPlayStatus==WindowsPhoneFilmPlayStatusLastFilm) { //上一部电影 NSLog(@"播放上一部电影"); } else if(WindowsPhoneFilmPlayStatus == WindowsPhoneFilmPlayStatusNextFilm) { //下一部电影 NSLog(@"播放下一部电影"); } else { //退出 NSLog(@"退出"); } } //setter 方法 -(void)setWindowsPhoneSize:(float)size { _size = 3.5; } //重写description方法 //这里重写方法要注意是重写的是对象方法还是类的方法 //用来调试 -(NSString *)description { return [NSString stringWithFormat:@"size = %f cpu = %f ram = %f ",_size,_cpu,_ram]; } @end
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文:http://blog.csdn.net/u012701023/article/details/46913953
内容总结
以上是互联网集市为您收集整理的ios设计一部WindowsPhone手机全部内容,希望文章能够帮你解决ios设计一部WindowsPhone手机所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。