Skip to content

Instantly share code, notes, and snippets.

@tomohisa
Created October 13, 2011 04:47
Show Gist options
  • Save tomohisa/1283407 to your computer and use it in GitHub Desktop.
Save tomohisa/1283407 to your computer and use it in GitHub Desktop.
test for synthesize
//
// ViewController.m
// test
//
// Created by Tomohisa Takaoka on 10/12/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@property (nonatomic, assign) int testval;
@end
@implementation ViewController
{
int _testval;
IBOutlet UILabel* label;
}
@synthesize testval;
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
_testval = 2;
self.testval = 1;
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)viewWillAppear:(BOOL)animated
{
label.text = [NSString stringWithFormat:@"%d",_testval];
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment