Skip to content

Instantly share code, notes, and snippets.

@jeradesign
Created January 3, 2014 04:07
Show Gist options
  • Save jeradesign/8232548 to your computer and use it in GitHub Desktop.
Save jeradesign/8232548 to your computer and use it in GitHub Desktop.
Hard Coded UI Example
//
// ViewController.m
// HardCodedUITest
//
// Created by John Brewer on 7/15/13.
// Copyright (c) 2013 Jera Design LLC. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
CGRect frame = CGRectMake(100, 100, 300, 100);
_button = [[UIButton alloc] initWithFrame:frame];
[_button setTitle:@"Hello" forState:UIControlStateNormal];
[[self view] addSubview:_button];
[_button addTarget:self action:@selector(doSomething) forControlEvents:UIControlEventTouchUpInside];
}
- (void)doSomething {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Hello" message:@"Hello, there." delegate:self cancelButtonTitle:@"Done" otherButtonTitles:nil];
[alertView show];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment