ios设计一部WindowsPhone手机
来源:互联网 发布:软件用户license设计 编辑:程序博客网 时间:2024/04/30 02:23
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
0 0
- ios设计一部WindowsPhone手机
- 为手机应用程序(Android、iOS、WindowsPhone)添加超声波通信技术
- 设计一部iphone手机用面向对象的方法
- WindowsPhone
- 设计WindowsPhone 应用www.maiziedu.com
- 三星概念机: 一支笔,一部手机
- 一部手机包含多少种化学元素?
- 整个手机界就是一部天龙八部
- 一部手机做好屏幕适配
- 【太原UI设计师】Windowsphone设计的规范你知道吗?
- Unity3d代码从Android/IOS迁移到WindowsPhone经验笔记
- 一月换一部:手机奢侈消费是消费变态
- 今天入手一部Nokia 5802 手机(诺基亚触摸屏音乐手机)
- [Economist] Print me a phone 给我印一部手机
- 一部高档手机70%的功能是没用的!
- 你真的认为iphone只是一部手机么?
- 玩TOP域名,你需要一部给力的手机
- 一部合格的手机是怎么生产出…
- JS校验金额格式的正则表达式
- 13298
- ConcurrentHashMap原理分析
- 数据库和数据仓库的区别
- 构造代码块、构造函数、静态代码块 学习笔记
- ios设计一部WindowsPhone手机
- WinForm 生命周期, WinForm 事件执行顺序
- [web安全] 上传漏洞之解析漏洞
- Spring Framework 的一些资料
- java bean
- GetDlgItem() 出现错误
- C++关键字mutable
- POJ 3186 Treats for the Cows (区间DP 水题)
- 【IOS】打开系统设置页面