简单画册(可编辑)

这里写图片描述

#import "AppDelegate.h"
#import "ViewController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
    [self.window makeKeyAndVisible];

    //创建导航栏控制器
    UINavigationController* nav = [[UINavigationController alloc]initWithRootViewController:[[ViewController alloc]init]];

    //设置应用程序的根控制器
    self.window.rootViewController = nav;
    return YES;
}

/

//
//  ViewController.m
//  E组_刘桂根_滚动视图画册考试20161209
//
//  Created by 还有谁!!!! on 16/12/9.
//  Copyright © 2016年 刘桂根. All rights reserved.
//

#import "ViewController.h"
#import "LGG_ViewController.h"
#import "AppDelegate.h"

@interface ViewController ()
@property (retain) UIButton* btn;
@property (retain) UILabel* Txt;

@property (retain)LGG_ViewController* lggVC;
@end

@implementation ViewController

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:YES];
    UIApplication* app = [UIApplication sharedApplication];
    AppDelegate* delegate = app.delegate;

    if (delegate.label.length > 0) {
        UILabel* txt = [self.view viewWithTag:delegate.num+19];
        txt.text = delegate.label;
    }
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"画册";

    _lggVC = [[LGG_ViewController alloc]init];

    //获取屏幕宽高
    CGFloat Width = [UIScreen mainScreen].bounds.size.width;
    CGFloat Height = [UIScreen mainScreen].bounds.size.height;

    //创建滚动视图,他也是继承自UIView,具有UIView的所有属性和方法,滚动视图本身不显示内容,他只是用来加载内容视图
    UIScrollView* sctollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 64, Width, Height-120)];
    //sctollView.backgroundColor = [UIColor cyanColor];
    [self.view addSubview:sctollView];


    //计算图片的宽高
    CGFloat imageViewWidth = Width/4;
    CGFloat imageViewHeight = imageViewWidth/2*3;

    //创建图片视图当做滚动视图的内容视图,内容视图要大于滚动视图的大小,最小一个像素
    NSArray* Arr = @[@"32_1.jpg",@"32_2.jpg",@"32_3.jpg",@"32_4.jpg",@"32_5.jpg",@"32_6.jpg",@"32_7.jpg",@"32_8.jpg",@"32_9.jpg",@"32_10.jpg",@"32_11.jpg",@"32_12.jpg",@"32_13.jpg",@"32_14.jpg",@"32_15.jpg",@""];
    NSInteger k = 0;
    for (NSInteger i = 0; i < 4; i++) {
        for (NSInteger j = 0; j < 4; j++) {
            _btn = [UIButton buttonWithType:UIButtonTypeCustom];
            _btn.frame = CGRectMake(imageViewWidth*j, imageViewHeight*i, imageViewWidth, imageViewHeight);
            [_btn setImage:[UIImage imageNamed:Arr[k]] forState:UIControlStateNormal];
            [_btn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
            _btn.tag = k+1;
            [sctollView addSubview:_btn];


            _Txt = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, _btn.frame.size.width, 30)];
            _Txt.textColor = [UIColor greenColor];
            //创建NSUserDefaults对象,NSUserDefaults可以储存的数据,如果要储存自定义类型的对象需要归档之后才能储存
            NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
            NSString* str = [ud objectForKey:[NSString stringWithFormat:@"%ld",_btn.tag]];
            if (str.length > 0) {
                _Txt.text = str;
            }else{
                _Txt.text = Arr[k];
            }
            _Txt.tag = k+20;
            _Txt.textAlignment = NSTextAlignmentCenter;
            [_btn addSubview:_Txt];
            k++;
        }
    }
    //防止内容视图下滑
    self.automaticallyAdjustsScrollViewInsets = NO;
    //设置滚动范围
    sctollView.contentSize = CGSizeMake(0,imageViewHeight*4);
    //取消反弹效果
    sctollView.bounces = NO;

}

-(void)btnAction:(UIButton*)sender
{
    //NSLog(@"%ld",(long)sender.tag);
    //UIButton* btn = [self.view viewWithTag:1];
    UIApplication* app = [UIApplication sharedApplication];
    AppDelegate* delegate = app.delegate;
    delegate.image = [UIImage imageNamed:[NSString stringWithFormat:@"32_%ld.jpg", (long)sender.tag]];
    delegate.num = sender.tag;
    //跳转到下一个页面
    [self.navigationController pushViewController:_lggVC animated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end

这里写图片描述

#import "LGG_ViewController.h"
#import "AppDelegate.h"

@interface LGG_ViewController ()
@property (retain)UIImageView* imageView;
@property (retain)UITextField* txtField;

@end

@implementation LGG_ViewController

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:YES];
    UIApplication* app = [UIApplication sharedApplication];
    AppDelegate* delegate = app.delegate;
    _imageView.image = delegate.image;
    _txtField.text = @"";
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];

    CGFloat Width = [UIScreen mainScreen].bounds.size.width;
    CGFloat Height = [UIScreen mainScreen].bounds.size.height;
    _txtField = [[UITextField alloc]initWithFrame:CGRectMake(0, 64, Width, 50)];
    _txtField.backgroundColor = [UIColor grayColor];
    //设置提示信息
    _txtField.placeholder=@"请输入照片名字";
    //设置清除按钮的显示模式
    _txtField.clearButtonMode=UITextFieldViewModeAlways;
    //创建点击手势
    UITapGestureRecognizer* tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction:)];
    //给self.view 加手势
    [self.view addGestureRecognizer:tap];
    [self.view addSubview:_txtField];

    //创建大图片
    _imageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 114, Width, Height-114)];
    [self.view addSubview:_imageView];

    //右边按钮
    UIButton* rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    rightBtn.frame = CGRectMake(0, 0, 50, 30);
    [rightBtn setTitle:@"完成" forState:UIControlStateNormal];
    [rightBtn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [rightBtn addTarget:self action:@selector(rightAction:) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:rightBtn];
}

-(void)rightAction:(UIBarButtonItem*)sender
{
    UIApplication* app = [UIApplication sharedApplication];
    AppDelegate* delegate = app.delegate;
    delegate.label = _txtField.text;


    //创建NSUserDefaults对象,NSUserDefaults可以储存的数据,如果要储存自定义类型的对象需要归档之后才能储存
    NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
    if (![_txtField.text isEqual:@""]) {
        delegate.label = _txtField.text;
        [ud setObject:delegate.label forKey:[NSString stringWithFormat:@"%ld",(long)delegate.num]];
    }

    //跳转到上一个页面
    [self.navigationController  popViewControllerAnimated:YES];
}

//设置手势点击
-(void)tapAction:(UITapGestureRecognizer*)sender
{
    [_txtField resignFirstResponder];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
AE画册坊是一套面向普通用户用于自助画册编辑的理想软件,系统提供众多专业而又易用的编辑工具,是国内仅有的完全支持页面编辑的工具型系统,非常适合于相册、画册、台历以及海报的制作。   1.提供多种画册规格,包括各类经典相册、台历和画报,同时支持用户自定义画册规格。   2.支持任意的图片布置,也提供专业的页面布置模板。   3.提供丰富的图片蒙板、插图以及结合蒙板与镶边的图片模版。   4.除了支持与微软PPT2003相同的艺术字字形,还支持任意形状的自由字体及任意轨迹的跟随字体。   5.支持对艺术字形的任意修改,创建独特的文字,并可让每个字在行间任意移动。   6.提供与PPT2003完全兼容的颜色填充功能。   7.支持大量的几何图形输入。   8.支持任意字形下的直接输入、选取、复制、黏贴等功能。   9.支持分页面恢复与重做功能,使用户编辑过程更为直观。   10.支持丰富的图片像质调整及范围裁剪功能。   11.支持灵活的视图缩放功能。   12.支持所有编辑元素的复制、黏贴,包括整个页的复制、黏贴,同时在线的不同画册间的整页(包括模版)黏贴,系统提供精确的自动布置功能。   13.支持多种形式的用户自定义模板,非常适合服务商作为为用户提供相册、台历等制作服务的软件平台。   14.提供完整的文件功能,使画册文件犹如普通文档文件,可以随意保存及复制。   15.独创的内存图片存取及优化功能,使软件在大量图片时一样轻松编辑。   16.可根据显示需要,生成小巧的可浏览可执行文件。   17.把多个图片、插图、图形及文字合成,生成组合图像,具备与其他图片一样的编辑功能。   18.提供图片、插图、图形及文字的预设及自定义三维投影显示,使画册内容更逼真。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值