2015-12-15-iOS UI 实现通讯记录
//
// RootViewController.m
// Phone2
//
// Created by YIem on 15/12/12.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//
import "RootViewController.h"
import "TLView.h"
@interface RootViewController ()
@end
@implementation RootViewController
(void)viewDidLoad {
[super viewDidLoad]; // Do any additional setup after loading the view. self.view.backgroundColor = [UIColor whiteColor]; // UISegmentedControl *seg = [[UISegmentedControl alloc]initWithItems:@[@"AII", @"Missed"]]; seg.frame = CGRectMake(100, 25, 150, 40); seg.center = CGPointMake(self.view.center.x, 50); [self.view addSubview:seg]; seg.backgroundColor = [UIColor whiteColor]; seg.selectedSegmentIndex = 0; [seg release]; // UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem]; button.frame = CGRectMake(0, 590,self.view.frame.size.width, 70); [self.view addSubview:button]; [button setBackgroundImage:[UIImage imageNamed:@"12.jpg"] forState:UIControlStateNormal]; button.self.layer.cornerRadius = 35;
//
TLView *yi = [[TLView alloc]initWithFrame:CGRectMake(0, 100, self.view.frame.size.width, 90)];
yi.label1.text = @"卞一";
yi.label2.text = @"187941459**";
yi.label3.text = @"星期六";
yi.label4.text = @"";
yi.img.image = [UIImage imageNamed:@"eat"];
[self.view addSubview:yi];
[yi release];
//
TLView *er = [[TLView alloc]initWithFrame:CGRectMake(0, 180, self.view.frame.size.width, 90)];
er.label1.text = @"YIem";
er.label2.text = @"188426740**";
er.label3.text = @"星期五";
er.label4.text = @"1";
er.img.image = [UIImage imageNamed:@"eat"];
[self.view addSubview:er];
[er release];
//
TLView *san = [[TLView alloc]initWithFrame:CGRectMake(0, 270, self.view.frame.size.width, 90)];
san.label1.text = @"YI";
san.label2.text = @"10101010101";
san.label3.text = @"星期六";
san.img.image = [UIImage imageNamed:@"eat"];
[self.view addSubview:san];
[san release];
//
TLView *si = [[TLView alloc]initWithFrame:CGRectMake(0, 360, self.view.frame.size.width, 90)];
si.label1.text = @"Bian";
si.label2.text = @"110110110";
si.label3.text = @"星期五";
si.img.image = [UIImage imageNamed:@"eat"];
[self.view addSubview:si];
[si release];
//
TLView *wu = [[TLView alloc]initWithFrame:CGRectMake(0, 450, self.view.frame.size.width, 90)];
wu.label1.text = @"吴晋儒";
wu.label2.text = @"1884268258";
wu.label3.text = @"星期六";
wu.img.image = [UIImage imageNamed:@"eat"];
[self.view addSubview:wu];
[wu release];
}
(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
//
// TLView.h
// Phone2
//
// Created by YIem on 15/12/12.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//
import <UIKit/UIKit.h>
@interface TLView : UIView
@property (nonatomic, retain)UILabel *label1;
@property (nonatomic, retain)UILabel *label2;
@property (nonatomic, retain)UILabel *label3;
@property (nonatomic, retain)UILabel *label4;
@property (nonatomic, retain)UIImageView *img;
@end
//
// TLView.m
// Phone2
//
// Created by YIem on 15/12/12.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//
import "TLView.h"
@implementation TLView
- (void)dealloc
{
[_label1 release];
[_label2 release];
[_label3 release];
[_label4 release];
[_img release];
[super dealloc];
} (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {[self creat];
}
return self;
}- (void)creat
{// 姓名
self.label1 = [[UILabel alloc]initWithFrame:CGRectMake(30, 10, 200, 40)];
self.label1.font = [UIFont systemFontOfSize:25];
[self addSubview:self.label1];
[_label1 release];
// 电话号码
self.label2 = [[UILabel alloc]initWithFrame:CGRectMake(30, 55, 200, 30)];
self.label2.font = [UIFont systemFontOfSize: 20];
[self addSubview:self.label2];
[_label2 release];
// 星期几
self.label3 = [[UILabel alloc]initWithFrame:CGRectMake(230, 30, 60, 30)];
self.label3.font = [UIFont systemFontOfSize:20];
[self addSubview:self.label3];
[_label3 release];
// 图片
self.img = [[UIImageView alloc]initWithFrame:CGRectMake(300, 30, 50, 50)];
self.img.layer.cornerRadius = 25;
self.img.clipsToBounds = YES;
[self addSubview:self.img];
// 线
self.label4 = [[UILabel alloc]initWithFrame:CGRectMake(30, 90, self.frame.size.width, 1)];
self.label4.backgroundColor = [UIColor grayColor];
[self addSubview:self.label4];
[_label4 release];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
(void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »