Note that there are some explanatory texts on larger screens.

plurals
  1. POhow i call method of button from viewdidload
    primarykey
    data
    text
    <p>I have 10 <code>UIButton</code> objects. I define a single action for all of them. I want to animate the <code>UIScrollView</code> to a desired image location when I on the related button. I have implemented this project using storyboards and I have one method for all 10 buttons. I gave a tag to each button in <code>viewDidLoad</code> in <code>viewcontroller.m</code> file like this </p> <pre><code>button1.tag = 10; button1.tag = 11; button1.tag = 12; button1.tag = 13; button1.tag = 14; button1.tag = 15; button1.tag = 16; button1.tag = 17; button1.tag = 18; button1.tag = 19; </code></pre> <p>// viewcontroller.m file </p> <pre><code>-(IBAction) Button1:(id) sender { [self performSegueWithIdentifier:@"nextView" sender:sender]; } </code></pre> <p>This button method will take me to nextviewcontroller and its working fine, but in <code>nextviewctontroller.m</code> file i want to animate my <code>UIScrollView</code> to desired location. I am doing it like this in <code>nextviewcontroller.m</code> file, but its not working.</p> <pre><code>viewDidload { if ([sender tag] == 10) { [yourScrollView scrollRectToVisible:CGRectMake(0,0,100,100) animated:YES]; } else if ([sender tag] == 11) { [yourScrollView scrollRectToVisible:CGRectMake(320,0,100,100) animated:YES]; } /* . . . . . . . and its continue to the last tag */ } </code></pre> <p>It does not animate the <code>UIScrollView</code> to the desired location and one thing remember here I have declared <code>sender</code> as type <code>id</code> in header file. Kindly tell me how I can animate <code>UIScrollView</code> to the desired location when I click on corresponding button. I also wanted to say I did not copy and paste this code from my xcode project. I wrote this code just give you idea what I want.</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