Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ViewController.h kiegészítése:
- // -(void)kattintas:(UIButton*)sender;
- //
- // ViewController.m
- // sikerelmeny_proba2
- //
- // Created by Hallgato on 2014.02.12..
- // Copyright (c) 2014 __MyCompanyName__. 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.
- self.view.backgroundColor=[UIColor whiteColor];
- UILabel *label =[[UILabel alloc] initWithFrame:CGRectMake(10, 50, 120, 30)];
- label.tag=999; // ez mindegy mennyi
- label.text=@"hello world";
- [self.view addSubview:label];
- [label release];
- UITextField *textfield=[[UITextField alloc] initWithFrame:CGRectMake(10, 10, 100, 30)];
- textfield.tag=1000;
- textfield.borderStyle = UITextBorderStyleRoundedRect;
- [self.view addSubview:textfield];
- [textfield release];
- UIButton *button=[UIButton buttonWithType:UIButtonTypeRoundedRect];
- button.frame=CGRectMake(120, 10, 100, 30);
- [button setTitle:@"Button" forState:UIControlStateNormal];
- [button addTarget:self action:@selector(kattintas:) forControlEvents:UIControlEventTouchUpInside];
- [self.view addSubview:button];
- }
- -(void)kattintas:(UIButton *)sender
- {
- UITextField *textfield=(UITextField*)[self.view viewWithTag:1000];
- UILabel *label=(UILabel*)[self.view viewWithTag:999];
- label.text=[NSString stringWithFormat:@"Hello %@", textfield.text];
- }
- - (void)viewDidUnload
- {
- [super viewDidUnload];
- // Release any retained subviews of the main view.
- }
- - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
- {
- return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement