Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

McBgnr

macrumors regular
Original poster
Apr 13, 2009
144
0
Hello,

In my program I want to cast a view to another. I write like this in viewDidLoad:

Code:
MyView *myView = (MyView *) self.view;
[myView display];

But when I call display I am getting unrecognised selector and on printing myView with NSLog I get UIView Object, instead of MyView.

I am not able to identify what is going wrong here. Pls suggest if there is any error here.
 
Thanks, that helped me figure it out. It had to be changed to MyView in the IB.


Another thing that I am facing a problem is that I want to use iPhone size view in a iPad application. But that view is not autoresizing. Any idea what has to be done?
 
Thanks, that helped me figure it out. It had to be changed to MyView in the IB.


Another thing that I am facing a problem is that I want to use iPhone size view in a iPad application. But that view is not autoresizing. Any idea what has to be done?

Have you set the autoresizing mask, either in IB or in the code?
 
Yes Autoresize Subviews is checked in IB. Still it is not getting resized. All the labels in the View display very small font instead of the one that I have set in IB.
 
Yes Autoresize Subviews is checked in IB. Still it is not getting resized. All the labels in the View display very small font instead of the one that I have set in IB.

It may be that you need to tell the view to size correctly on the iPad depending on the controller type it's loading into. With regards to the fonts are you using ones that actually exist on the target device?
 
Thanks for the quick response.

I have no idea how to tell the view to size correctly on the iPad? any pointers will be helpful.

I am only checking on the simulator now. So font should be there.
 
How is the view being loaded and presented? I assume you are using a view controller? Regardless I would look at setNeedsLayout.

For what it's worth I'm in the early stages of porting one of my apps to the iPad and my views just work in a UISplitView...
 
Yes, I am using a View controller. I will take a look at setNeedsLayout and see if it is working.
 
This isn't the answer

Yes Autoresize Subviews is checked in IB.

to this question

Code:
Have you set the autoresizing mask, either in IB or in the code?

You need to set the autoResizingmask property, in IB with the springs and struts or in code. Have you done that and is it not working the way it should?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.