Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What you are saying can be done by code by adding a subview to your mainview and slide it up and down to make it visible and unvisible.</p> <p>1) Add a subview to far y coordinate so that initially its not visible in the view.</p> <pre><code>subView = [[UIView alloc]initWithFrame:CGRectMake(0,470,320,200)]]; // subView is an ivar // Add stuffs to your subview [self.view addSubview:subView]; </code></pre> <p>2) Now make two IBActions showMySubview and hideMySubview and link them to the corresponding buttons or you can do some toggling with one button by checking its label.text.</p> <p>3) In your showMySubview</p> <pre><code> [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:1.5]; [UIView setAnimationDelay:0.0]; subView.frame = CGRectMake(0, 50, 320, 200); [UIView commitAnimations]; </code></pre> <p>4) In your hideMySubview</p> <pre><code> [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:1.5]; [UIView setAnimationDelay:0.0]; editPopUpView.frame = CGRectMake(0, 470, 320, 200); [UIView commitAnimations]; </code></pre> <p>You can also do some beautify things to your subview to look some good add <strong>QuartzCore</strong> framework to your project and import it in your .m file and add these lines after adding your subview to your mainview the import is <strong>#import "QuartzCore/QuartzCore.h"</strong></p> <pre><code>[[subView layer] setCornerRadius:12.0f]; [[subView layer] setMasksToBounds:YES]; [[subView layer] setBorderWidth:4.0f]; [subView layer].borderColor = [UIColor purpleColor].CGColor; </code></pre> <p>Hope This will help you in anyways :)</p> <p><strong>EDIT :</strong></p> <p>Adding buttons via code to your subview :</p> <pre><code>for (int i = 0; i &lt; 3; i++) { for (int j = 0; j &lt; 3; j++) { UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.frame = CGRectMake(j*60,200+ 35 * i ,50 , 30); //[btn setTitle:@"Test" forState:UIControlStateNormal]; [btn setBackgroundImage:[UIImage imageNamed:@"normal.png"] forState:UIControlStateNormal]; [btn setBackgroundImage:[UIImage imageNamed:@"selected.png"] forState:UIControlStateHighlighted]; btn.tag = (j + 1) + (3 * i); [btn addTarget:self action:@selector(subViewButtonClicked:) forControlEvents:UIControlEventTouchUpInside]; btn.showsTouchWhenHighlighted = YES; [subView addSubview:btn]; // its the subview we added to our main view add this after initializing the subview } } </code></pre> <p>Now a function to catch the clicks of all the buttons</p> <pre><code>-(IBAction)subViewButtonClicked:(id)sender { switch ([sender tag]) { case 1: { // Do your stuff here NSLog(@"the tag of sender is %i",[sender tag]); break; } case 2: { // Do your stuff here NSLog(@"the tag of sender is %i",[sender tag]); break; } case 3: { // Do your stuff here NSLog(@"the tag of sender is %i",[sender tag]); break; } case 4: { // Do your stuff here NSLog(@"the tag of sender is %i",[sender tag]); break; } case 5: { // Do your stuff here NSLog(@"the tag of sender is %i",[sender tag]); break; } case 6: { // Do your stuff here NSLog(@"the tag of sender is %i",[sender tag]); break; } case 7: { // Do your stuff here NSLog(@"the tag of sender is %i",[sender tag]); break; } case 8: { // Do your stuff here NSLog(@"the tag of sender is %i",[sender tag]); break; } case 9: { // Do your stuff here NSLog(@"the tag of sender is %i",[sender tag]); break; } default: break; } } </code></pre> <p>There may be many easy ways out there but hope this will get you a start :)</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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