Last active
July 10, 2017 11:26
-
-
Save gadmyth/353c6ff7594759d62c9bc4714debc631 to your computer and use it in GitHub Desktop.
AnchorPoint test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.m | |
// AnchorPointTest | |
// | |
// Created by gadmyth on 7/10/17. | |
// Copyright © 2017 gadmyth. All rights reserved. | |
// | |
#import "ViewController.h" | |
@interface ViewController () | |
@property (strong, nonatomic) UITextField *t1; | |
@property (strong, nonatomic) UITextField *t2; | |
@property (strong, nonatomic) CALayer *mLayer; | |
@end | |
@implementation ViewController | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
_t1 = [[UITextField alloc] initWithFrame:CGRectMake(10, 70, 100, 40)]; | |
_t1.borderStyle = UITextBorderStyleRoundedRect; | |
_t1.placeholder = @"请输入0~1内值"; | |
_t2 = [[UITextField alloc] initWithFrame:CGRectMake(120, 70, 100, 40)]; | |
_t2.borderStyle = UITextBorderStyleRoundedRect; | |
_t2.placeholder = @"请输入0~1内值"; | |
[self.view addSubview:_t1]; | |
[self.view addSubview:_t2]; | |
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(10, 120, 60, 40)]; | |
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; | |
[button setTitle:@"确定" forState:UIControlStateNormal]; | |
[button addTarget:self action:@selector(anchorPointChanged:) forControlEvents:UIControlEventTouchUpInside]; | |
[self.view addSubview:button]; | |
_mLayer = [CALayer layer]; | |
_mLayer.backgroundColor = [[UIColor alloc] initWithRed:0.7 green:0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment