Matt
Matt

Reputation: 435

xcode interface builder - resizing or moving a view

I'm following the cs193p course on iTunes U, and all is going well until now.

I'm creating my iPad version of the graphing calculator and trying to add the toolbar to the iPad detail view so it can hold the UIbutton to return to the master view, but I can not resize the view (contained within the view controller) to enable me to add the toolbar, without it becoming a subview of the view.

Because It's a little hard to explain I've taken 2 screencaps. One of the video from Stanford of what is supposed to happen and one of what happens when I do the same.

The short version: I drag out a view from the palette and drop it onto the view controller, it automatically fills the entire view controller and trying to move or resize it in any way has no impact.

At first I thought maybe it was some weird setting on my project, so I've created a test project and starting from scratch which has the same results.

I'm using xcode 4.3, but got the same results using xcode 4.2

It's slightly confusing and I'm fairly certain this didn't happen when I first started the course a couple of months ago.

I've read a couple of possibly similar questions/problems suggesting needing to alter settings in the "simulated user interface" section but had no success understanding what I need to set them to and random settings haven't yielded positive results!

http://vimeo.com/38315249 video of what should happen

http://vimeo.com/38315452 video of what is actually happening (nothing)

Thanks!

Update: Thanks! Putting the graphview inside a standard view worked...kind of

It solved the immediate problem, but has possibly introduced another problem.

Now, when I run the app, my axes are displayed on the graph as expected. I specify a program to graph, but drawrect doesn't get called again after the initial screen draw.

I can only assume that this is now because my graphview is now a subview of another view, as on the iPhone (universal app) it still works fine, and correctly draws the graph but that segues between the calculator and the graph.

Update again

Ignore me I'm being stupid. In trying to solve the first problem, i'd deleted my original graphview, and when I added a new one, I hadn't hooked up the outlet again. Hence why nothing was happening! All sorted!

Upvotes: 1

Views: 2559

Answers (1)

Mick MacCallum
Mick MacCallum

Reputation: 130193

The difference I see between the two videos is a simple matter of layer stacking...

In the first video, when the UIView was dragged onto the ViewController, there was already a UIView on the ViewController, and therefore allowed the view added on top to be moved around and resize. Where as in the second video, you were doing it right, but you just need another step. After you drag the UIView onto the ViewController and it locks into place, perform the same action again only this time you'll be dragging the UIView directly on top of the first UIView. I tested this for confirmation, and it achieves your intended result.

Upvotes: 2

Related Questions