Skip to content

Commit

Permalink
细节修改
Browse files Browse the repository at this point in the history
  • Loading branch information
woaomo committed Aug 27, 2015
1 parent 965f17e commit 93b4b19
Showing 1 changed file with 44 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@

#import "GateDetailViewController.h"

typedef enum : NSUInteger {
FieldTypeGate,
FieldTypeContact,
FieldTypePhone,
FieldTypeLoca,
FieldTypeDate
} FieldType;

@interface GateDetailViewController ()
{
UIScrollView *_bgScrollView;
Expand Down Expand Up @@ -37,7 +45,7 @@ - (void)viewDidLoad {
_titleArray = @[@"门店名称:",@"联系人:",@"联系电话:",@"门店地址:",@"添加日期:"];
NSArray *contentArray = @[@"南京母婴乐嘉店",@"董枫",@"13311251225",@"北京市朝阳区团结湖北头条",@"2015-07-14 14:32:34"];

CGFloat endWidth = 0;
CGFloat endHeight = 0;
for (int i=0; i<_titleArray.count; i++)
{
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 15+45*i, 16, 16)];
Expand All @@ -56,6 +64,10 @@ - (void)viewDidLoad {
textField.tag = 100+i;
[_bgScrollView addSubview:textField];
textField.text = contentArray[i];
if (i==FieldTypePhone)
{
textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
}

UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(titleLabel.right, textField.bottom+2, textField.width+5, 0.5)];
lineView.backgroundColor = RGBCOLOR(220, 220, 220);
Expand All @@ -65,9 +77,11 @@ - (void)viewDidLoad {
rightView.image = [UIImage imageNamed:@"rightArrow"];
[_bgScrollView addSubview:rightView];

endWidth = lineView.bottom;
endHeight = lineView.bottom;
}
_bgScrollView.contentSize = CGSizeMake(kMainScreenWidth, endWidth+5);

CGFloat contentH = _bgScrollView.height+1>endHeight+5?_bgScrollView.height+1:endHeight+5;
_bgScrollView.contentSize = CGSizeMake(kMainScreenWidth, contentH);


UIColor *btnColor = [UIColor orangeColor];
Expand All @@ -94,30 +108,49 @@ - (void)touchLeftBtn
{
if (self.isEdit==NO)//执行编辑
{
self.isEdit = YES;
[self.leftBtn setTitle:@"保存" forState:UIControlStateNormal];
[self.rightBtn setTitle:@"取消" forState:UIControlStateNormal];
[self edit];
}
else//执行保存
{

[self save];
}
}

- (void)touchRightBtn
{
if (self.isEdit==NO)//执行删除
{

[self delete];
}
else//执行取消
{
self.isEdit = NO;
[self.leftBtn setTitle:@"修改" forState:UIControlStateNormal];
[self.rightBtn setTitle:@"删除" forState:UIControlStateNormal];
[self cancel];
}
}

- (void)edit
{
self.isEdit = YES;
[self.leftBtn setTitle:@"保存" forState:UIControlStateNormal];
[self.rightBtn setTitle:@"取消" forState:UIControlStateNormal];
}

- (void)save
{

}

- (void)delete
{

}

- (void)cancel
{
self.isEdit = NO;
[self.leftBtn setTitle:@"修改" forState:UIControlStateNormal];
[self.rightBtn setTitle:@"删除" forState:UIControlStateNormal];
}


#pragma mark setter isEdit
Expand Down

0 comments on commit 93b4b19

Please sign in to comment.