0

I need your counsel about a problem I have. It´s about my iPhone simulator. When I run the program, it´s fine and perfectly okay on the vertical view.

However, on the horizontal view the buttons move to another position. "CGContextDrawPath" This is the function reference I used to draw the graph. Is it possible to use this function on which to add buttons, so that these don´t move like the graph. Could you possibly suggest another solution so that that the buttons don´t move and hold the same position like shown on the vertical view.

Vertical view - iPhone Horizontal view - iPhone

Community
  • 1
  • 1
Neru-J
  • 1,623
  • 2
  • 23
  • 38

1 Answers1

0

I thought it looks better horizontally? Just kidding....

If I really understood you correctly, you want it to be as the vertical view. There's a very simple and lazy solution to it:

Step 1 : Go to your project name with the BLUE icon. Click the TARGET. Go to the SUMMARY PAGE. Select SUPPORTED ORIENTATION to be only Portrait. (The first one, you can also pick the second one but you have to adjust the code below as well)

Step 2: Go into your view controller m file. There should be a method like this. Just uncomment it.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    return (interfaceOrientation == UIInterfaceOrientationPortrait);

}

This method makes sure that it will always check for the interface orientation and only return YES, when the interface is actually Portrait.

minjiera
  • 336
  • 3
  • 16