Re: [iPhone 3.0; XCode 3.1.3] Question about when views are available for manipulation.
Re: [iPhone 3.0; XCode 3.1.3] Question about when views are available for manipulation.
- Subject: Re: [iPhone 3.0; XCode 3.1.3] Question about when views are available for manipulation.
- From: Brian Bruinewoud <email@hidden>
- Date: Mon, 10 Aug 2009 21:29:27 +1000
All,
Thanks for the responses so far. I'm getting there.
If I may quote Henry McGilton (Boulevardier) out of order:
On 10/08/2009, at 15:02 , Henry McGilton (Boulevardier) wrote:
Similar situation with the call to makeKeyAndVisible - I've seen
samples of applicationDidFinishLaunching where makeKeyAndVisible is
called and then set up is done to the main window's view.
I (and I am sure many others) would be highly interested to see
these sample codes to which
you refer. In general, if you make the window visible first and
then load up your initial screen
and add it to the window, the user will see a (possibly unpleasant)
'flash' as the new stuff is added.
A more user-friendly approach is to (quickly) load the initial UI,
add it to the window, and then
display the window.
It is not an Apple example.
Example: http://media.pragprog.com/titles/amiphd/code/FileIO/FilesystemExplorer/Classes/FilesystemExplorerAppDelegate.m
For this book: http://books.pragprog.com/titles/amiphd/iphone-sdk-development
But I agree with you that it could cause a flash of invalid data/
layout, followed by the correct data/layout.
So, is the above example broken? Note that the property directoryPath
has an explicit setDirectoryPath method that can be seen here:
http://media.pragprog.com/titles/amiphd/code/FileIO/FilesystemExplorer/Classes/DirectoryViewController.m
So, I have one last question about what you said here:
In the first simple alloc-init style, the design assumption is that
the View Controller will fabricate
its managed view 'manually' *when the View Controller is asked to do
so* by referencing its view property.
In the second, initWithNibName style, the design assumption is that
initWithNibName tells
the newly allocated View Controller the name of the NIB that it
*will* load (in the future)
*when the View Controller is asked to do so* by referencing its view
property.
In the normal course of events, when is the View Controller asked to
fabricate its managed view?
- (IBAction) readFileContents {
FileContentsViewController *fileContentsViewController =
[[FileContentsViewController alloc]
initWithNibName: @"FileContentsView"
bundle:nil];
fileContentsViewController.filePath = filePath;
fileContentsViewController.title = [NSString stringWithFormat: @"%@
contents",
[filePath lastPathComponent]];
[[self navigationController] pushViewController:
fileContentsViewController animated:YES];
[fileContentsViewController release];
}
Thanks for all your help.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden