ifish/Ifish/controllers/FishTinkController/maincontroller/PuasiphysicalSkinViewContro...

229 lines
9.3 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// PuasiphysicalSkinViewController.m
// Ifish
//
// Created by ifish7ios on 16/4/26.
// Copyright © 2016年 imac. All rights reserved.
//
#import "PuasiphysicalSkinViewController.h"
#define btnWid 100
#define kPlace ([UIScreen mainScreen].bounds.size.width - btnWid*2) /4
@interface PuasiphysicalSkinViewController ()
@end
@implementation PuasiphysicalSkinViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self creatPuasiphysicalSkin];
//[self creatFirstNewSkin];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - 拟物
-(void)creatPuasiphysicalSkin{
self.setImag.hidden = YES;
self.SetTimeButton.hidden = YES;
//self.erWeiButton.hidden = YES;
self.dulabel.hidden = YES;
//self.shuixiangwendu.hidden = YES;
UIImageView *backImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Puasiphysical"]];
[self.tableView setBackgroundView:backImage];
UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(30 , kPlace/3 , kPlace * 2 + btnWid - 50, (kPlace * 2 + btnWid - 50)/2)];
// leftBtn.backgroundColor = [UIColor redColor];
[leftBtn setBackgroundImage:[UIImage imageNamed:@"basion_logo"] forState:UIControlStateNormal];
UILabel *textLbl = [[UILabel alloc] initWithFrame:CGRectMake(0 , kPlace/3 +(kPlace * 2 + btnWid - 50)/2 , kScreenSize.width / 2 , 20)];
textLbl.text = @"品牌展示位";
textLbl.textColor = [UIColor whiteColor];
textLbl.font = [UIFont boldSystemFontOfSize:14];
// textLbl.backgroundColor = [UIColor redColor];
textLbl.textAlignment = NSTextAlignmentCenter;
[self.tableView addSubview:textLbl];
[self.tableView addSubview:leftBtn];
CGFloat withSetPlace = kScreenSize.width/2 - (5 /2) + (kScreenSize.width/4 -(btnWid - 60)/2 ) ;
UIButton *rightBtn = [[UIButton alloc] initWithFrame:CGRectMake(withSetPlace , kPlace/3 + (((kPlace * 2 + btnWid - 50)/2) -(btnWid - 60))/2 , btnWid - 60 ,btnWid - 60)];
// rightBtn.backgroundColor = [UIColor redColor];
[rightBtn setImage:[UIImage imageNamed:@"xutosetting"] forState:UIControlStateNormal];
[rightBtn addTarget:self action:@selector(rightBtnClick:) forControlEvents:UIControlEventTouchUpInside];
textLbl = [[UILabel alloc] initWithFrame:CGRectMake(kScreenSize.width / 2 ,kPlace/3 +(kPlace * 2 + btnWid - 50)/2 , kScreenSize.width / 2 , 20)];
textLbl.text = @"水族箱设置";
//textLbl.backgroundColor = [UIColor redColor];
textLbl.textAlignment = NSTextAlignmentCenter;
textLbl.font = [UIFont boldSystemFontOfSize:14];
textLbl.textColor = [UIColor whiteColor];
[self.tableView addSubview:textLbl];
[self.tableView addSubview:rightBtn];
UIImageView *line = [[UIImageView alloc] initWithFrame:CGRectMake(kPlace + btnWid +kPlace -2 , kPlace/3, 5, 80)];
//line.backgroundColor = [UIColor colorWithRed:215/255.0f green:245/255.0f blue:246/254.0f alpha:0.7];
line.image = [UIImage imageNamed:@"line"];
[self.tableView addSubview:line];
UIImageView *bubble = [[UIImageView alloc] initWithFrame:CGRectMake((kScreenSize.width -(kScreenSize.width - 2 * kPlace ))/2, kPlace + 80 , kScreenSize.width - 2 * kPlace, kScreenSize.width - 2 * kPlace)];
//bubble.backgroundColor = [UIColor redColor];
bubble.image = [UIImage imageNamed:@"bubble"];
[self.tableView addSubview:bubble];
CGFloat btnControlWith = kScreenSize.width*7/32;
CGFloat btnControlPlace = (kScreenSize.width - 3*btnControlWith * 105 / 122 )/4;
NSLog(@"*-*-*-*-*-屏幕宽度%f",kScreenSize.width);
for (int i = 0; i < 3; i ++) {
UIButton *btnControl = [[UIButton alloc] init] ;
btnControl.frame = CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith * 105 / 122), kScreenSize.height - 2*btnControlPlace - btnControlWith -40 , btnControlWith * 105 / 122, btnControlWith );
// [btnControl setImage:[UIImage imageNamed:[NSString stringWithFormat:@"btn%d_off",i + 4]] forState:UIControlStateNormal];
if (i==0) {
[btnControl setImage:[UIImage imageNamed:[NSString stringWithFormat:@"PFLight%d_on",i + 1]] forState:UIControlStateNormal];
}else if(i == 1){
[btnControl setImage:[UIImage imageNamed:[NSString stringWithFormat:@"PFLight%d_off",i ]] forState:UIControlStateNormal];
}else{
[btnControl setImage:[UIImage imageNamed:@"ChongLang_on"] forState:UIControlStateNormal];
}
// btnControl.backgroundColor = [UIColor whiteColor];
textLbl = [[UILabel alloc] initWithFrame:CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith * 105 / 122), kScreenSize.height - 2*btnControlPlace - btnControlWith -50 + btnControlWith, btnControlWith * 7 / 8, btnControlPlace -10)];
// textLbl.backgroundColor = [UIColor blackColor];
textLbl.textAlignment = NSTextAlignmentCenter;
textLbl.textColor = [UIColor colorWithRed:101/255.0f green:103/255.0f blue:103/254.0f alpha:1];
NSArray *arr = @[@"灯1",@"灯2",@"UV冲浪"];
textLbl.font = [UIFont boldSystemFontOfSize:13];
// textLbl.backgroundColor = [UIColor redColor];
textLbl.text = arr[i];
[self.tableView addSubview:textLbl];
[self.tableView addSubview:btnControl];
}
UILabel *temp = [[UILabel alloc] initWithFrame:CGRectMake(30, 100, kScreenSize.width - 2 * kPlace - 100, kScreenSize.width - 2 * kPlace - 200)];
temp.text = @"13.5";
//temp.font = [UIFont systemFontOfSize:60];
temp.font = [UIFont fontWithName:@"Avenir Next Condensed" size:70];
temp.textColor = [UIColor colorWithRed:101/255.0f green:103/255.0f blue:103/255.0f alpha:1];
// temp.backgroundColor = [UIColor yellowColor];
temp.textAlignment = NSTextAlignmentCenter;
[bubble addSubview:temp];
UILabel *oc = [[UILabel alloc] initWithFrame:CGRectMake((kScreenSize.width - 2 * kPlace)/3*2 -10 , 110 ,50, kScreenSize.width - 2 * kPlace - 210)];
oc.text = @"°C";
// oc.backgroundColor = [UIColor blueColor];
// oc.font = [UIFont systemFontOfSize:40];
oc.textColor = [UIColor colorWithRed:101/255.0f green:103/255.0f blue:103/254.0f alpha:1];
oc.font = [UIFont fontWithName:@"Avenir Next Condensed" size:40];
NSLog(@"-----%@",[UIFont familyNames]);
[bubble addSubview:oc];
}
-(void)rightBtnClick:(UIButton *)sender{
NSLog(@"点击设置按钮");
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 0;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 0;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 0;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CELL =@"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CELL];
if (cell == nil) {
cell = [[UITableViewCell alloc ]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CELL];
}
return cell;
}
-(void)creatFirstNewSkin{
UIView *vi = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenSize.width, kScreenSize.height /4)];
vi.backgroundColor = [UIColor colorWithRed:233/255.0f green:247/255.0f blue:254/255.0f alpha:1];
self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg2.png"]];
[self.tableView addSubview:vi];
CGFloat btnWith = 100;
CGFloat withSetPlace = kScreenSize.width/2+2 + (kScreenSize.width /2 - btnWith + 30)/2 ;
UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(30 , 10 , kPlace * 2 + btnWith - 50, btnWith - 30)];
[leftBtn setBackgroundImage:[UIImage imageNamed:@"basion_logo"] forState:UIControlStateNormal];
[vi addSubview:leftBtn];
UILabel *leftTextLbl = [[UILabel alloc] initWithFrame:CGRectMake(0 , btnWith - 20, kScreenSize.width / 2 -2 , 20)];
leftTextLbl.text = @"品牌展示位";
leftTextLbl.textColor = [UIColor colorWithRed:100/255.0f green:100/255.0f blue:100/255.0f alpha:1];
leftTextLbl.font = [UIFont boldSystemFontOfSize:18];
leftTextLbl.textAlignment = NSTextAlignmentCenter;
[vi addSubview:leftTextLbl];
UIButton *rightBtn = [[UIButton alloc] initWithFrame:CGRectMake(withSetPlace , 20 , btnWith - 50 ,btnWith - 50)];
[rightBtn setImage:[UIImage imageNamed:@"xutosetting"] forState:UIControlStateNormal];
[vi addSubview:rightBtn];
UILabel *textLbl = [[UILabel alloc] initWithFrame:CGRectMake(kScreenSize.width / 2 -2, btnWith -20 , kScreenSize.width / 2 -2, 20)];
textLbl.text = @"水族箱设置";
textLbl.textColor = [UIColor whiteColor];
textLbl.textAlignment = NSTextAlignmentCenter;
textLbl.font = [UIFont boldSystemFontOfSize:18];
textLbl.textColor = [UIColor colorWithRed:100/255.0f green:100/255.0f blue:100/255.0f alpha:1];
[vi addSubview:textLbl];
UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake(kPlace + btnWith +kPlace , 10, 2, btnWith)];
line.backgroundColor = [UIColor colorWithRed:201/255.0f green:201/255.0f blue:201/254.0f alpha:1];
[vi addSubview:line];
}
@end