// 从字典里通过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