In my three 20 project i am calling and sending some parameters to a method of my view controller using map object. I am passing the image name through parameter to my view controller. I have bound a xib file with my view controller . my xib contains a toolbar at the top and uiimage view. My problem is that when i pass parameter to my custom method and load my xib file in the next line then my view controller’s view is not displayed on the screen. I am receiving the parameter in my custom method but unable to load xib on the screen.
I am using the following custom method
-(void)loadImageWithName:(NSString *)img
{
PhotoView *vw = [[PhotoView alloc] initWithNibName:@"PhotoView" bundle:nil];
UIImage *tempImage = [UIImage imageNamed:img];
[vw.drawImage setImage:tempImage];
[self presentModalViewController:vw animated:YES];
}
When i do this i can see my xib loaded on the window.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[TTURLRequestQueue mainQueue] setMaxContentLength:0];
TTNavigator *navigator = [TTNavigator navigator];
navigator.window = _window;
TTURLMap *map = navigator.URLMap;
[map from:@"tt://appPhotos" toSharedViewController:[PhotoViewController class]];
[map from:@"tt://photo" toSharedViewController:[PhotoView class]];
[navigator openURLAction:[TTURLAction actionWithURLPath:@"tt://photo"]];
[_window makeKeyAndVisible];
return YES;
}
But when i do this my xib does not load and i see only a white screen
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[TTURLRequestQueue mainQueue] setMaxContentLength:0];
TTNavigator *navigator = [TTNavigator navigator];
navigator.window = _window;
TTURLMap *map = navigator.URLMap;
[map from:@"tt://appPhotos" toSharedViewController:[PhotoViewController class]];
[map from:@"tt://photo/(loadImageWithName:)" toSharedViewController:[PhotoView class]];
[navigator openURLAction:[TTURLAction actionWithURLPath:@"tt://photo/myphoto.png"]];
[_window makeKeyAndVisible];
return YES;
}
This is the issue that i am facing right now.
I solved the above issue by using
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[TTURLRequestQueue mainQueue] setMaxContentLength:0];
TTNavigator *navigator = [TTNavigator navigator];
navigator.window = _window;
TTURLMap *map = navigator.URLMap;
[map from:@"tt://appPhotos" toSharedViewController:[PhotoViewController class]];
[map from:@"tt://photo/detail?name=(initWithImage:)" toSharedViewController:[PhotoView class]];
[navigator openURLAction:[TTURLAction actionWithURLPath:[NSString stringWithFormat:@"tt://photo/detail?name=%@",@"level_me_up_small.png"]]];
[_window makeKeyAndVisible];
return YES;
}
But still there are two probe.
- i am getting extra space between my toolbar at top and uiimageview.
2.UIImageView image is not changed to instant_poetry_small.png.
not sure if it will help, but try this:
instead of
the rest of the code looks OK for me