面试那些事

面试必须问的一个:

1.单例;

//创建一个单例飞机

//创建一个单例飞机

+ (Plane *)sharePlane {//单例不需要释放

    static Plane * plane;

    if (!plane) {

        plane = [[Plane alloc]init];

    }

    return plane;

}

2.动画

for (int i =1; i < 14; i++) {

            UIImage *image = [UIImageimageNamed:[NSStringstringWithFormat:@"png%d.png",i]];

            [_images addObject:image];

        }


    UIImageView *imageView = [[UIImageViewalloc]initWithFrame:CGRectMake(0,100, 320, 200)];

    //设置默认图片

    imageView.image = [UIImageimageNamed:@"png1.png"];//动画结束之后会显示默认图片一般要设置一下

    //设置简易动画

    //设置动画数组(首先要有一个图片数组)

    imageView.animationImages = _images;

    //设置动画周期   (播放一组动画需要的时间)

    imageView.animationDuration = 0.5;

    //设置动画播放的次数/这个数组播放多少次

    imageView.animationRepeatCount =0;//0代表无限次

3.协议 。让你写一个协议

protocol ChangeColor <NSObject>

- (void)changeColor;

@end


[_delegate changeColor];//修改第一张视图的背景颜色 一般要在这里回调方法





@interface SubViewController : UIViewController

{

    id <ChangeColor> _delegate;

}

@property (nonatomic,assign)id <ChangeColor> delegate;



#import <UIKit/UIKit.h>

#import "SubViewController.h"

@interface RootViewController :UIViewController <ChangeColor>//RootViewController遵守SubViewController制定的协议


在这里实现协议方法

- (void)changeColor {

}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值