Re: View shifted up on iPhone simulator

2009-10-03 Thread Anthony Smith
Thanks for the input. I was just trying to load a particular XIB based  
on the device being used. Each XIB would communicate something  
different. It sounds like I can scratch this idea for something  
simpler using UIViewController. I'll reread the programming and  
reference guides and rethink my solution. Again, thanks for the input!


On Oct 2, 2009, at 8:37 PM, Hank Heijink (Mailinglists) wrote:

I second the previous poster's opinion: view controllers are  
definitely the way to go here. They'll let you take care of rotation  
and plenty of other stuff: read the view controller programming  
guide. Using a view controller gives you many more places to  
customize what happens.


There's viewDidLoad for initial setup, viewDidUnload for cleanup,  
viewWillAppear, viewDidAppear, and related methods for more frequent  
stuff, you name it. See the documentation for UIViewController.


What you want to achieve is easily done in viewDidLoad, or if you  
want to have complete control without using Interface Builder, in  
loadView. Depending on how different your views are depending on the  
device, there may be simpler solutions.


Good luck,
Hank

On Oct 2, 2009, at 4:08 PM, Anthony Smith wrote:

Hm, I opted to set the view's programmatically rather than through  
a controller so I could control what view is initially displayed  
depending on the device (iPhone, iPod, etc.). I'm assuming I will  
be able to achieve something like this even when using view  
controllers?


On Oct 2, 2009, at 3:56 PM, Christopher J Kemsley wrote:


Hmm I have a few comments:

It look like you're seeing the superposition of two problems that  
look like one:


1) The status bar is covering up the very top of your view in the  
sim


2) The bottom button is 20px further from the bottom in the sim


The interface builder likes to make views default to a height of  
460, not 480. I always change mine to 480 before I start using  
them. From your pictures, it looks like this is the culprit -  
that, and the status bar covering up the top. In order to change  
it, you must disable the 'simulate status bar' option in the  
view's inspector.


I believe that view is designed to be shown in a view controller  
who takes the status bar into account already. I also believe that  
you simply added the view as a subview of the window, which is  
what caused the status bar to cover up the top. (also, the  
interface builder shows you what the view would look like in a  
view controller that takes the status bar into account)


From this, you have a few options:

1) Disable the status bar in your application, set the view's  
Simulated Interface Elements to not show the status bar, then  
change the hight of the view to 480. To disable the status bar in  
your application, go to its info.plist, add a new row, scroll to  
the bottom, select Status Bar is Initially Hidden and set it to  
TRUE.


2) Use a view controller to show your view. I didn't fully  
understand just what the controllers did until after a very long  
time of tinkering, but they're a godsend... or, an apple-send in  
this case. They'll help making stuff like that line up, though  
only after you understand them.


or 3) Use both the above options (this is my recommendation)




On 2 Oct 2009, at 12:28 PM, Anthony Smith wrote:

When I run my app in the iPhone simulator the view seems to be  
shifted up on the screen. If that doesn't make sense I've  
uploaded some images. Take a look and see if you've run into this  
before.


http://projects.sticksnleaves.com/iphonedev/ib.png

http://projects.sticksnleaves.com/iphonedev/sim.png

Thanks!___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kd7qis%40gmail.com

This email sent to kd7...@gmail.com




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/hank.list%40runbox.com

This email sent to hank.l...@runbox.com






smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

View shifted up on iPhone simulator

2009-10-02 Thread Anthony Smith
When I run my app in the iPhone simulator the view seems to be shifted  
up on the screen. If that doesn't make sense I've uploaded some  
images. Take a look and see if you've run into this before.


http://projects.sticksnleaves.com/iphonedev/ib.png

http://projects.sticksnleaves.com/iphonedev/sim.png

Thanks!

smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: View shifted up on iPhone simulator

2009-10-02 Thread Hank Heijink (Mailinglists)
I believe -[UIScreen applicationFrame] returns different values for  
phone and simulator in OS 3.0. From your screenshots I have no idea if  
that's your problem though. Did you layout your view in IB or did you  
do that programmatically?


Best to set a breakpoint where you position your content, or at least  
in -viewDidLoad and find out where exactly the difference is.


Good luck,
Hank

On Oct 2, 2009, at 3:28 PM, Anthony Smith wrote:

When I run my app in the iPhone simulator the view seems to be  
shifted up on the screen. If that doesn't make sense I've uploaded  
some images. Take a look and see if you've run into this before.


http://projects.sticksnleaves.com/iphonedev/ib.png

http://projects.sticksnleaves.com/iphonedev/sim.png

Thanks!___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/hank.list 
%40runbox.com


This email sent to hank.l...@runbox.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: View shifted up on iPhone simulator

2009-10-02 Thread Anthony Smith
I don't do any size or position calculations. I just set the view. I  
don't do anything fancy. This is the only area of the code I mess with  
the view.


On Oct 2, 2009, at 3:51 PM, Hank Heijink (Mailinglists) wrote:

Doesn't look like the relevant code to me: I see no size or position  
calculations here. That's where your problem will be.


Hank

On Oct 2, 2009, at 3:48 PM, Anthony Smith wrote:

I'm doing it programmatically. I'll see if I can figure that out  
when I get a chance. Here's the relevant code in my app delegate:


- (UIView *)determineView {
Device device = [DeviceDetection currentDevice];

if (device == IPOD_1G || device == IPOD_2G || device == UNKNOWN) {
		[self setViewController:[[UIViewController alloc]  
initWithNibName:@UnsupportedDeviceView bundle:[NSBundle  
mainBundle]]];

} else {
		[self setViewController:[[ShuffleViewController alloc]  
initWithNibName:@ShuffleView bundle:[NSBundle mainBundle]]];

}

return [viewController view];
}


- (void)applicationDidFinishLaunching:(UIApplication *)application {
   [window addSubview:[self determineView]];
   [window makeKeyAndVisible];
}

On Oct 2, 2009, at 3:40 PM, Hank Heijink (Mailinglists) wrote:

I believe -[UIScreen applicationFrame] returns different values  
for phone and simulator in OS 3.0. From your screenshots I have no  
idea if that's your problem though. Did you layout your view in IB  
or did you do that programmatically?


Best to set a breakpoint where you position your content, or at  
least in -viewDidLoad and find out where exactly the difference is.


Good luck,
Hank

On Oct 2, 2009, at 3:28 PM, Anthony Smith wrote:

When I run my app in the iPhone simulator the view seems to be  
shifted up on the screen. If that doesn't make sense I've  
uploaded some images. Take a look and see if you've run into this  
before.


http://projects.sticksnleaves.com/iphonedev/ib.png

http://projects.sticksnleaves.com/iphonedev/sim.png

Thanks!___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/hank.list%40runbox.com

This email sent to hank.l...@runbox.com










smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: View shifted up on iPhone simulator

2009-10-02 Thread Christopher J Kemsley

Hmm I have a few comments:

It look like you're seeing the superposition of two problems that look  
like one:


1) The status bar is covering up the very top of your view in the sim

2) The bottom button is 20px further from the bottom in the sim


The interface builder likes to make views default to a height of 460,  
not 480. I always change mine to 480 before I start using them. From  
your pictures, it looks like this is the culprit - that, and the  
status bar covering up the top. In order to change it, you must  
disable the 'simulate status bar' option in the view's inspector.


I believe that view is designed to be shown in a view controller who  
takes the status bar into account already. I also believe that you  
simply added the view as a subview of the window, which is what caused  
the status bar to cover up the top. (also, the interface builder shows  
you what the view would look like in a view controller that takes the  
status bar into account)


From this, you have a few options:

1) Disable the status bar in your application, set the view's  
Simulated Interface Elements to not show the status bar, then change  
the hight of the view to 480. To disable the status bar in your  
application, go to its info.plist, add a new row, scroll to the  
bottom, select Status Bar is Initially Hidden and set it to TRUE.


2) Use a view controller to show your view. I didn't fully understand  
just what the controllers did until after a very long time of  
tinkering, but they're a godsend... or, an apple-send in this case.  
They'll help making stuff like that line up, though only after you  
understand them.


or 3) Use both the above options (this is my recommendation)




On 2 Oct 2009, at 12:28 PM, Anthony Smith wrote:

When I run my app in the iPhone simulator the view seems to be  
shifted up on the screen. If that doesn't make sense I've uploaded  
some images. Take a look and see if you've run into this before.


http://projects.sticksnleaves.com/iphonedev/ib.png

http://projects.sticksnleaves.com/iphonedev/sim.png

Thanks!___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kd7qis%40gmail.com

This email sent to kd7...@gmail.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: View shifted up on iPhone simulator

2009-10-02 Thread Anthony Smith
Sorry, I just reread your previous message. I layout the view in IB. I  
load the view programmatically. I'm also using the 3.1 simulator.


On Oct 2, 2009, at 3:52 PM, Anthony Smith wrote:

I don't do any size or position calculations. I just set the view. I  
don't do anything fancy. This is the only area of the code I mess  
with the view.


On Oct 2, 2009, at 3:51 PM, Hank Heijink (Mailinglists) wrote:

Doesn't look like the relevant code to me: I see no size or  
position calculations here. That's where your problem will be.


Hank

On Oct 2, 2009, at 3:48 PM, Anthony Smith wrote:

I'm doing it programmatically. I'll see if I can figure that out  
when I get a chance. Here's the relevant code in my app delegate:


- (UIView *)determineView {
Device device = [DeviceDetection currentDevice];

if (device == IPOD_1G || device == IPOD_2G || device == UNKNOWN) {
		[self setViewController:[[UIViewController alloc]  
initWithNibName:@UnsupportedDeviceView bundle:[NSBundle  
mainBundle]]];

} else {
		[self setViewController:[[ShuffleViewController alloc]  
initWithNibName:@ShuffleView bundle:[NSBundle mainBundle]]];

}

return [viewController view];
}


- (void)applicationDidFinishLaunching:(UIApplication *)application {
  [window addSubview:[self determineView]];
  [window makeKeyAndVisible];
}

On Oct 2, 2009, at 3:40 PM, Hank Heijink (Mailinglists) wrote:

I believe -[UIScreen applicationFrame] returns different values  
for phone and simulator in OS 3.0. From your screenshots I have  
no idea if that's your problem though. Did you layout your view  
in IB or did you do that programmatically?


Best to set a breakpoint where you position your content, or at  
least in -viewDidLoad and find out where exactly the difference is.


Good luck,
Hank

On Oct 2, 2009, at 3:28 PM, Anthony Smith wrote:

When I run my app in the iPhone simulator the view seems to be  
shifted up on the screen. If that doesn't make sense I've  
uploaded some images. Take a look and see if you've run into  
this before.


http://projects.sticksnleaves.com/iphonedev/ib.png

http://projects.sticksnleaves.com/iphonedev/sim.png

Thanks!___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/hank.list%40runbox.com

This email sent to hank.l...@runbox.com












smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: View shifted up on iPhone simulator

2009-10-02 Thread Anthony Smith
Hm, I opted to set the view's programmatically rather than through a  
controller so I could control what view is initially displayed  
depending on the device (iPhone, iPod, etc.). I'm assuming I will be  
able to achieve something like this even when using view controllers?


On Oct 2, 2009, at 3:56 PM, Christopher J Kemsley wrote:


Hmm I have a few comments:

It look like you're seeing the superposition of two problems that  
look like one:


1) The status bar is covering up the very top of your view in the sim

2) The bottom button is 20px further from the bottom in the sim


The interface builder likes to make views default to a height of  
460, not 480. I always change mine to 480 before I start using them.  
From your pictures, it looks like this is the culprit - that, and  
the status bar covering up the top. In order to change it, you must  
disable the 'simulate status bar' option in the view's inspector.


I believe that view is designed to be shown in a view controller who  
takes the status bar into account already. I also believe that you  
simply added the view as a subview of the window, which is what  
caused the status bar to cover up the top. (also, the interface  
builder shows you what the view would look like in a view controller  
that takes the status bar into account)


From this, you have a few options:

1) Disable the status bar in your application, set the view's  
Simulated Interface Elements to not show the status bar, then  
change the hight of the view to 480. To disable the status bar in  
your application, go to its info.plist, add a new row, scroll to the  
bottom, select Status Bar is Initially Hidden and set it to TRUE.


2) Use a view controller to show your view. I didn't fully  
understand just what the controllers did until after a very long  
time of tinkering, but they're a godsend... or, an apple-send in  
this case. They'll help making stuff like that line up, though only  
after you understand them.


or 3) Use both the above options (this is my recommendation)




On 2 Oct 2009, at 12:28 PM, Anthony Smith wrote:

When I run my app in the iPhone simulator the view seems to be  
shifted up on the screen. If that doesn't make sense I've uploaded  
some images. Take a look and see if you've run into this before.


http://projects.sticksnleaves.com/iphonedev/ib.png

http://projects.sticksnleaves.com/iphonedev/sim.png

Thanks!___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kd7qis%40gmail.com

This email sent to kd7...@gmail.com






smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: View shifted up on iPhone simulator

2009-10-02 Thread Anthony Smith
Not sure if this matters but when I run the view from IB the view  
looks fine. However, when I run my application from Xcode it shifts  
everything up. Just thought I'd put that out there.


On Oct 2, 2009, at 4:08 PM, Anthony Smith wrote:

Hm, I opted to set the view's programmatically rather than through a  
controller so I could control what view is initially displayed  
depending on the device (iPhone, iPod, etc.). I'm assuming I will be  
able to achieve something like this even when using view controllers?


On Oct 2, 2009, at 3:56 PM, Christopher J Kemsley wrote:


Hmm I have a few comments:

It look like you're seeing the superposition of two problems that  
look like one:


1) The status bar is covering up the very top of your view in the sim

2) The bottom button is 20px further from the bottom in the sim


The interface builder likes to make views default to a height of  
460, not 480. I always change mine to 480 before I start using  
them. From your pictures, it looks like this is the culprit - that,  
and the status bar covering up the top. In order to change it, you  
must disable the 'simulate status bar' option in the view's  
inspector.


I believe that view is designed to be shown in a view controller  
who takes the status bar into account already. I also believe that  
you simply added the view as a subview of the window, which is what  
caused the status bar to cover up the top. (also, the interface  
builder shows you what the view would look like in a view  
controller that takes the status bar into account)


From this, you have a few options:

1) Disable the status bar in your application, set the view's  
Simulated Interface Elements to not show the status bar, then  
change the hight of the view to 480. To disable the status bar in  
your application, go to its info.plist, add a new row, scroll to  
the bottom, select Status Bar is Initially Hidden and set it to  
TRUE.


2) Use a view controller to show your view. I didn't fully  
understand just what the controllers did until after a very long  
time of tinkering, but they're a godsend... or, an apple-send in  
this case. They'll help making stuff like that line up, though only  
after you understand them.


or 3) Use both the above options (this is my recommendation)




On 2 Oct 2009, at 12:28 PM, Anthony Smith wrote:

When I run my app in the iPhone simulator the view seems to be  
shifted up on the screen. If that doesn't make sense I've uploaded  
some images. Take a look and see if you've run into this before.


http://projects.sticksnleaves.com/iphonedev/ib.png

http://projects.sticksnleaves.com/iphonedev/sim.png

Thanks!___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kd7qis%40gmail.com

This email sent to kd7...@gmail.com








smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: View shifted up on iPhone simulator

2009-10-02 Thread Luke the Hiesterman
Views shouldn't be drawn to the full height of 480 unless you intend  
to hide the status bar. The application window extends behind the  
status bar, so if you add a view to the window with frame.origin.y =  
0.0, it will be behind the status bar. Unless you're hiding the status  
bar, your view's frame.origin.y should be 20.0


Interface builder just shows you the view and knows nothing of its  
superview (the window) so that's why the apparent shift.


Luke

On Oct 2, 2009, at 2:11 PM, Anthony Smith wrote:

Not sure if this matters but when I run the view from IB the view  
looks fine. However, when I run my application from Xcode it shifts  
everything up. Just thought I'd put that out there.


On Oct 2, 2009, at 4:08 PM, Anthony Smith wrote:

Hm, I opted to set the view's programmatically rather than through  
a controller so I could control what view is initially displayed  
depending on the device (iPhone, iPod, etc.). I'm assuming I will  
be able to achieve something like this even when using view  
controllers?


On Oct 2, 2009, at 3:56 PM, Christopher J Kemsley wrote:


Hmm I have a few comments:

It look like you're seeing the superposition of two problems that  
look like one:


1) The status bar is covering up the very top of your view in the  
sim


2) The bottom button is 20px further from the bottom in the sim


The interface builder likes to make views default to a height of  
460, not 480. I always change mine to 480 before I start using  
them. From your pictures, it looks like this is the culprit -  
that, and the status bar covering up the top. In order to change  
it, you must disable the 'simulate status bar' option in the  
view's inspector.


I believe that view is designed to be shown in a view controller  
who takes the status bar into account already. I also believe that  
you simply added the view as a subview of the window, which is  
what caused the status bar to cover up the top. (also, the  
interface builder shows you what the view would look like in a  
view controller that takes the status bar into account)


From this, you have a few options:

1) Disable the status bar in your application, set the view's  
Simulated Interface Elements to not show the status bar, then  
change the hight of the view to 480. To disable the status bar in  
your application, go to its info.plist, add a new row, scroll to  
the bottom, select Status Bar is Initially Hidden and set it to  
TRUE.


2) Use a view controller to show your view. I didn't fully  
understand just what the controllers did until after a very long  
time of tinkering, but they're a godsend... or, an apple-send in  
this case. They'll help making stuff like that line up, though  
only after you understand them.


or 3) Use both the above options (this is my recommendation)




On 2 Oct 2009, at 12:28 PM, Anthony Smith wrote:

When I run my app in the iPhone simulator the view seems to be  
shifted up on the screen. If that doesn't make sense I've  
uploaded some images. Take a look and see if you've run into this  
before.


http://projects.sticksnleaves.com/iphonedev/ib.png

http://projects.sticksnleaves.com/iphonedev/sim.png

Thanks!___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kd7qis%40gmail.com

This email sent to kd7...@gmail.com






___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com

This email sent to luket...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: View shifted up on iPhone simulator

2009-10-02 Thread Anthony Smith

Beautiful! That did it!

- (UIView *)determineView {
Device device = [DeviceDetection currentDevice];

if (device == IPOD_1G || device == IPOD_2G || device == UNKNOWN) {
		[self setViewController:[[UIViewController alloc]  
initWithNibName:@UnsupportedDeviceView bundle:[NSBundle mainBundle]]];

} else {
		[self setViewController:[[ShuffleViewController alloc]  
initWithNibName:@ShuffleView bundle:[NSBundle mainBundle]]];

}   

CGRect frame = [viewController view].frame;

frame.origin.y = 20;

[[viewController view] setFrame:frame];

return [viewController view];
}

Thanks a ton Luke!

On Oct 2, 2009, at 5:16 PM, Luke the Hiesterman wrote:

Views shouldn't be drawn to the full height of 480 unless you intend  
to hide the status bar. The application window extends behind the  
status bar, so if you add a view to the window with frame.origin.y =  
0.0, it will be behind the status bar. Unless you're hiding the  
status bar, your view's frame.origin.y should be 20.0


Interface builder just shows you the view and knows nothing of its  
superview (the window) so that's why the apparent shift.


Luke

On Oct 2, 2009, at 2:11 PM, Anthony Smith wrote:

Not sure if this matters but when I run the view from IB the view  
looks fine. However, when I run my application from Xcode it shifts  
everything up. Just thought I'd put that out there.


On Oct 2, 2009, at 4:08 PM, Anthony Smith wrote:

Hm, I opted to set the view's programmatically rather than through  
a controller so I could control what view is initially displayed  
depending on the device (iPhone, iPod, etc.). I'm assuming I will  
be able to achieve something like this even when using view  
controllers?


On Oct 2, 2009, at 3:56 PM, Christopher J Kemsley wrote:


Hmm I have a few comments:

It look like you're seeing the superposition of two problems that  
look like one:


1) The status bar is covering up the very top of your view in the  
sim


2) The bottom button is 20px further from the bottom in the sim


The interface builder likes to make views default to a height of  
460, not 480. I always change mine to 480 before I start using  
them. From your pictures, it looks like this is the culprit -  
that, and the status bar covering up the top. In order to change  
it, you must disable the 'simulate status bar' option in the  
view's inspector.


I believe that view is designed to be shown in a view controller  
who takes the status bar into account already. I also believe  
that you simply added the view as a subview of the window, which  
is what caused the status bar to cover up the top. (also, the  
interface builder shows you what the view would look like in a  
view controller that takes the status bar into account)


From this, you have a few options:

1) Disable the status bar in your application, set the view's  
Simulated Interface Elements to not show the status bar, then  
change the hight of the view to 480. To disable the status bar in  
your application, go to its info.plist, add a new row, scroll to  
the bottom, select Status Bar is Initially Hidden and set it to  
TRUE.


2) Use a view controller to show your view. I didn't fully  
understand just what the controllers did until after a very long  
time of tinkering, but they're a godsend... or, an apple-send in  
this case. They'll help making stuff like that line up, though  
only after you understand them.


or 3) Use both the above options (this is my recommendation)




On 2 Oct 2009, at 12:28 PM, Anthony Smith wrote:

When I run my app in the iPhone simulator the view seems to be  
shifted up on the screen. If that doesn't make sense I've  
uploaded some images. Take a look and see if you've run into  
this before.


http://projects.sticksnleaves.com/iphonedev/ib.png

http://projects.sticksnleaves.com/iphonedev/sim.png

Thanks!___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kd7qis 
%40gmail.com


This email sent to kd7...@gmail.com






___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com

This email sent to luket...@apple.com






smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at 

Re: View shifted up on iPhone simulator

2009-10-02 Thread David Duncan

On Oct 2, 2009, at 2:30 PM, Anthony Smith wrote:


if (device == IPOD_1G || device == IPOD_2G || device == UNKNOWN) {
		[self setViewController:[[UIViewController alloc]  
initWithNibName:@UnsupportedDeviceView bundle:[NSBundle  
mainBundle]]];



This seems like a bit of brute force... what are you really trying to  
detect by looking at the device type?

--
David Duncan
Apple DTS Animation and Printing

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: View shifted up on iPhone simulator

2009-10-02 Thread Hank Heijink (Mailinglists)
I second the previous poster's opinion: view controllers are  
definitely the way to go here. They'll let you take care of rotation  
and plenty of other stuff: read the view controller programming guide.  
Using a view controller gives you many more places to customize what  
happens.


There's viewDidLoad for initial setup, viewDidUnload for cleanup,  
viewWillAppear, viewDidAppear, and related methods for more frequent  
stuff, you name it. See the documentation for UIViewController.


What you want to achieve is easily done in viewDidLoad, or if you want  
to have complete control without using Interface Builder, in loadView.  
Depending on how different your views are depending on the device,  
there may be simpler solutions.


Good luck,
Hank

On Oct 2, 2009, at 4:08 PM, Anthony Smith wrote:

Hm, I opted to set the view's programmatically rather than through a  
controller so I could control what view is initially displayed  
depending on the device (iPhone, iPod, etc.). I'm assuming I will be  
able to achieve something like this even when using view controllers?


On Oct 2, 2009, at 3:56 PM, Christopher J Kemsley wrote:


Hmm I have a few comments:

It look like you're seeing the superposition of two problems that  
look like one:


1) The status bar is covering up the very top of your view in the sim

2) The bottom button is 20px further from the bottom in the sim


The interface builder likes to make views default to a height of  
460, not 480. I always change mine to 480 before I start using  
them. From your pictures, it looks like this is the culprit - that,  
and the status bar covering up the top. In order to change it, you  
must disable the 'simulate status bar' option in the view's  
inspector.


I believe that view is designed to be shown in a view controller  
who takes the status bar into account already. I also believe that  
you simply added the view as a subview of the window, which is what  
caused the status bar to cover up the top. (also, the interface  
builder shows you what the view would look like in a view  
controller that takes the status bar into account)


From this, you have a few options:

1) Disable the status bar in your application, set the view's  
Simulated Interface Elements to not show the status bar, then  
change the hight of the view to 480. To disable the status bar in  
your application, go to its info.plist, add a new row, scroll to  
the bottom, select Status Bar is Initially Hidden and set it to  
TRUE.


2) Use a view controller to show your view. I didn't fully  
understand just what the controllers did until after a very long  
time of tinkering, but they're a godsend... or, an apple-send in  
this case. They'll help making stuff like that line up, though only  
after you understand them.


or 3) Use both the above options (this is my recommendation)




On 2 Oct 2009, at 12:28 PM, Anthony Smith wrote:

When I run my app in the iPhone simulator the view seems to be  
shifted up on the screen. If that doesn't make sense I've uploaded  
some images. Take a look and see if you've run into this before.


http://projects.sticksnleaves.com/iphonedev/ib.png

http://projects.sticksnleaves.com/iphonedev/sim.png

Thanks!___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kd7qis%40gmail.com

This email sent to kd7...@gmail.com




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/hank.list 
%40runbox.com


This email sent to hank.l...@runbox.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com