Note that there are some explanatory texts on larger screens.

plurals
  1. POtextfield for ios
    primarykey
    data
    text
    <p>i am very new to <code>iOS</code> and xcode. i want to create a textfield without using nib files or storyboard. i searched for the answers but everywhere its kind of confusing or they have used nib files. i have created buttons and its working fine but for textfields m facing problems. here is my <code>viewcontroller.m</code> please help. </p> <pre><code>#import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)loadView { self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; self.view.backgroundColor = [UIColor purpleColor]; UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; UIButton *button1 = [UIButton buttonWithType:UIButtonTypeRoundedRect]; UITextField *textfield; button.frame = CGRectMake(10 ,350 , 300, 40); button1.frame = CGRectMake(10 ,50 , 300, 40); textfield.frame = CGRectMake(10, 100, 200, 30); [button setTitle:@"Change screen to green!" forState:UIControlStateNormal]; [button1 setTitle:@"click screen to red!" forState:UIControlStateNormal]; [button addTarget:self action:@selector(buttonPressed) forControlEvents:UIControlEventTouchUpInside]; [button1 addTarget:self action:@selector(buttonPressed1) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button]; [self.view addSubview:button1]; [self.view addSubview:textfield]; } -(void)buttonPressed { self.view.backgroundColor = [UIColor greenColor]; } -(void)buttonPressed1 { self.view.backgroundColor = [UIColor redColor]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); } @end </code></pre> <p>thanks &amp; regards </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload