Skip to content

Instantly share code, notes, and snippets.

@gadmyth
Last active July 10, 2017 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gadmyth/353c6ff7594759d62c9bc4714debc631 to your computer and use it in GitHub Desktop.
Save gadmyth/353c6ff7594759d62c9bc4714debc631 to your computer and use it in GitHub Desktop.
AnchorPoint test
//
// 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