蓝懿IOS学习核心动画和UIImagePicker

今天的学习内容感觉有点吃力,好在自己用了三个小时的练习巩固了知识点,刘国斌老师在上午的课上讲了有关核心动画的内容,
并带着我们练习了一个模拟下雪的动画demo,自己独立很快的酒就写出来了,很有自豪感。下午的内容讲了如何在系统中通过UIImsagePickerController取到系统里的相册内容和显示到主页面。
     感觉今天学了好多东西,刘国斌老师耐心的把很多难点都注释了,讲了这么去实现和应用。在这里的感觉让我每天都有一种干劲,加油。
  (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info{

    // 从字典里通过key值获取原始图片和修改后的图片

    /*

   

    // 开启用户交互

    iv1.userInteractionEnabled=YES;

    

    [self.ss addSubview:iv1];

    // 把选择的图片的添加到数组

    [self.views addObject:iv1];

    self.ss.contentSize=CGSizeMake(self.views.count*80, 0);

    // 每张图片添加删除按钮

    UIButton *remo=[[UIButton alloc]initWithFrame:CGRectMake(50, 0, 30, 20)];

    [remo setTitle:@"X" forState:UIControlStateNormal];

    [remo setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

    [remo addTarget:self action:@selector(shanchu:) forControlEvents:UIControlEventTouchUpInside];

    [iv1 addSubview:remo];

    

    

//    [self dismissViewControllerAnimated:YES completion:nil];

}

//   当导航器跳转页面时候,执行,

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController*)viewController animated:(BOOL)animated{

    // 判断当导航控制器为二级界面的时候,添加uiview

    if (navigationController.viewControllers.count==2) {

        UIView *vv=[[UIView alloc]initWithFrame:CGRectMake(0, 567, 375, 100)];

        vv.backgroundColor=[UIColor redColor];

        [viewController.view addSubview:vv];

        // 创建scrolview

        self.ss=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 20, 375, 80)];

        self.ss.backgroundColor=[UIColor blueColor];

        [vv addSubview:self.ss];

        UIButton *bb=[[UIButton alloc]initWithFrame:CGRectMake(300, 0, 50, 20)];

        [bb setTitle:@"done" forState:UIControlStateNormal];

        bb.backgroundColor=[UIColor purpleColor];

        [bb addTarget:self action:@selector(done) forControlEvents:UIControlEventTouchUpInside];

        

        //done按钮添加到view

        [vv addSubview:bb];

        

        /////////////////////////////////

         //设置系统页面显示图片的控件的尺寸 不然的话会被自己添加的控件盖上

        UIView *puView=[viewController.view.subviews firstObject ];

        CGRect fram=puView.frame;

        fram.size.height=557;

        puView.frame=fram;

        // 查看当前页面上的所有子试图

//        NSLog(@"%@",viewController.view.subviews);

    }

}

//  图片删除按钮点击事件

-(void)shanchu:(UIButton*)sender{

    [sender.superview removeFromSuperview];

    [self.views removeObject:sender.superview];

    

    for (int i=0; i<self.views.count; i++) {

        UIImageView *iv3=self.views[i];

        CGRect fram=iv3.frame;

        fram.origin.x=i*80;

        iv3.frame=fram;

        

    }

}

//  done完成按钮执行事件

-(void)done{

    [self dismissViewControllerAnimated:YES completion:nil];

    for (int i=0; i<self.views.count    ; i++) {

        UIImageView *iv3=self.views[i];

        [self.view addSubview:iv3];

        UIButton *ss=[iv3.subviews lastObject];

        [ss removeFromSuperview];

    }

}

@end

 

你可能感兴趣的:(蓝懿IOS学习核心动画和UIImagePicker)