//
// ViewController.m
// 韩寒一个
//
// Created by ma c on 16/1/22.
// Copyright © 2016年 wangleilei. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@property (nonatomic,strong)UIButton* butt;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// UIImage* image = [UIImage imageNamed:@""]
UIImageView* imageview = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"sucan"] ];
imageview.frame = CGRectMake(20/2, 209/2, 711/2, 526/2);
// imageview.image = [UIImage imageNamed:@"sucai"];
UIView* v = [[UIView alloc]initWithFrame:CGRectMake(2.5, 0, 740/2, 124/2)];
v.backgroundColor = [UIColor colorWithRed:121/255.f green:121/255.f blue:121/255.f alpha:0.5];
UILabel* lableLeftCenter = [[UILabel alloc]initWithFrame:CGRectMake(320/2, 69/2, 95/2, 46/2)];
lableLeftCenter.text = @"ONE";
lableLeftCenter.textColor = [UIColor grayColor];
lableLeftCenter.font = [UIFont boldSystemFontOfSize:20];
UILabel* lableYi = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(lableLeftCenter.frame), lableLeftCenter.frame.origin.y-10, 95/2, 40)];
lableYi.text = @"一\n人";
lableYi.numberOfLines = 2;
lableYi.textColor = [UIColor grayColor];
lableYi.font = [UIFont boldSystemFontOfSize:12];
UILabel* lable652 = [[UILabel alloc]initWithFrame:CGRectMake(652/2, 0, 70/2, 80)];
lable652.text = @"...\n";
lable652.numberOfLines = 2;
lable652.textColor = [UIColor grayColor];
lable652.font = [UIFont boldSystemFontOfSize:34];
UILabel* lableLeftTop = [[UILabel alloc]initWithFrame:CGRectMake(12, 78, 200, 8)];
lableLeftTop.text = @"VOL. 1210";
lableLeftTop.textColor = [UIColor blackColor];
lableLeftTop.font = [UIFont systemFontOfSize:11];
UILabel* lableRightBottom = [[UILabel alloc]initWithFrame:CGRectMake(620/2, 759/2, 111/2, 49/2)];
lableRightBottom.numberOfLines = 0;
lableRightBottom.text = @" 钢琴师\n熊宇 作品";
lableRightBottom.font = [UIFont systemFontOfSize:10];
//设置段落
NSMutableParagraphStyle* paragra = [[NSMutableParagraphStyle alloc]init];
// paragra.lineBreakMode = 10;
paragra.lineSpacing = 10;//距离上边界和下边界的 像素
paragra.paragraphSpacing= 10;
NSDictionary* dict = @{
NSFontAttributeName:[UIFont systemFontOfSize:15],
NSForegroundColorAttributeName:[UIColor blueColor],
NSParagraphStyleAttributeName:paragra,
};
UIEdgeInsets insets = UIEdgeInsetsMake(60/3.f, 26/3.f, 23/3.f, 25/3.f);
// UIView* v = [[UIView alloc]init];
UIImage* image = [UIImage imageNamed:@"qipao"];
UIImageView* imageView = [[UIImageView alloc]init ];
// CGRectMake(20 ,40 , self.view.frame.size.width-40, 200)];
// image.size = [szietofit]
image = [image resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch];
// imageView.backgroundColor = [ui]
imageView.image = image;
// lable.backgroundColor = [UIColor colorWithPatternImage:image];
UILabel* lable = [[UILabel alloc]init];
NSString* string = @"沉默寡言的人,也许是不愿意背粗暴拆开的礼物;复杂难解的心,其实在等待一个耐心打磨钥匙的人。by 乌冬";
lable.text = string;
lable.numberOfLines = 0;
lable.font = [UIFont systemFontOfSize:14];
// lable.backgroundColor = [UIColor orangeColor];
// lable.frame = imageView.frame;
// lable.frame = CGRectMake(10, 10, 10, 10);
CGSize size = [string boundingRectWithSize:CGSizeMake(522/2, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:dict context:nil].size;
lable.frame = CGRectMake(184/2 +20, 854/2, size.width-20, size.height);
imageView.frame = CGRectMake(184/2, 854/2, size.width+40-20, size.height);
// lable.center = imageView.center = self.view.center;
//23
UILabel* lable23 = [[UILabel alloc]initWithFrame:CGRectMake(10, imageView.frame.origin.y, 60, 40)];
// lable23.backgroundColor = [UIColor orangeColor];
lable23.textAlignment = NSTextAlignmentCenter;
lable23.text = @"23";
lable23.textColor = [UIColor colorWithRed:49/255.f green:182/255.f blue:237/255.f alpha:1];
lable23.font = [UIFont systemFontOfSize:45];
//jan 2016
UILabel* jan = [[UILabel alloc]initWithFrame:CGRectMake(14, CGRectGetMaxY(lable23.frame), 80, 20)];
jan.text = @"Jan.2016";
jan.font = [UIFont systemFontOfSize:12];
UIButton* but = [UIButton buttonWithType:UIButtonTypeCustom];
but.frame = CGRectMake(631/2+10, 1131/2, 70, 25);
but.backgroundColor = [UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:0.9];
but.layer.cornerRadius =10;
but.titleLabel.text = @"487";
but.titleLabel.textAlignment = NSTextAlignmentLeft;
but.titleLabel.font = [UIFont systemFontOfSize:9];
[but setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[but setTitle:@"❤️487" forState:UIControlStateSelected];
[but setTitle:@"��486" forState:UIControlStateNormal];
[but addTarget:self action:@selector(change:) forControlEvents:UIControlEventTouchUpInside];
self.butt = but;
// ♡♥️��❤️ but.selected = YES;
// [;
but.tintColor = [UIColor greenColor];
// but.imageView lable652
[self.view addSubview:lable652];
[self.view addSubview:lableYi];
[self.view addSubview:but];
[self.view addSubview:jan];
[self.view addSubview:lable23];
[self.view addSubview:imageView ];
[self.view addSubview:lable ];
// lableLeftTop
[self.view addSubview:v];
[self.view addSubview:lableLeftCenter];
[self.view addSubview:lableRightBottom];
[self.view addSubview:lableLeftTop];
[self.view addSubview:imageview];
}
-(void)change:(UIButton*)bt{
bt.selected = !bt.selected;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
ios学习之模仿韩寒"one.一个"UI
最新推荐文章于 2021-12-14 11:39:44 发布