ios设计一部WindowsPhone手机

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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值