Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-28-2010, 08:59 AM   #1 (permalink)
Registered Member
 
Join Date: Dec 2010
Location: Germany, Frankfurt
Posts: 30
brush51 is on a distinguished road
Question After saving image jumping to View X

Hey guys,

i want to show a View X after saving an image(exactly after scanning a barcode with ZBar).

I have a tabbarcontroller with 4 tabbaritems.
-The first one is for scanning/opening camera
-The second one shows the history of scanned data (navigationcontroller, drill to detail view)

and i want to show the detail page of the navigationcontroller after scanning a barcode/saving a picture.
How can i do that?

For better understanding i have sketched a little bit


thanks for help,
brush51

sketch: http://img708.imageshack.us/img708/7779/img0215bp.jpg

Last edited by brush51; 12-28-2010 at 09:27 AM. Reason: delete attachment and add link of the sketch
brush51 is offline   Reply With Quote
Old 12-28-2010, 09:17 AM   #2 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

attachments doesn't work in this forum.

if i'm not wrong the method that you want is
Code:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{

}
if not, check apple docs of UIImagePickerController
__________________
dany_dev is offline   Reply With Quote
Old 12-29-2010, 09:07 AM   #3 (permalink)
Registered Member
 
Join Date: Dec 2010
Location: Germany, Frankfurt
Posts: 30
brush51 is on a distinguished road
Default

Quote:
Originally Posted by dany88 View Post
attachments doesn't work in this forum.

if i'm not wrong the method that you want is
Code:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{

}
if not, check apple docs of UIImagePickerController
Tanks dany88,

i know this method.

But i dont know how to show another XIB-File after scanning a barcode..
brush51 is offline   Reply With Quote
Old 12-29-2010, 10:36 AM   #4 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

google for switch view, you will find a ton examples.
__________________
dany_dev is offline   Reply With Quote
Old 12-30-2010, 03:43 AM   #5 (permalink)
Registered Member
 
Join Date: Dec 2010
Location: Germany, Frankfurt
Posts: 30
brush51 is on a distinguished road
Default

Quote:
Originally Posted by dany88 View Post
google for switch view, you will find a ton examples.
I know that i should use presentModalViewController.

I have already googled and i have tried some tutorials, but if i scan from the camera and after that change to view the app chrashes(after scanning and before changing the view).

it would be very gentle if you can give more help.

thanks,
brush51
brush51 is offline   Reply With Quote
Old 01-02-2011, 10:43 AM   #6 (permalink)
Registered Member
 
Join Date: Dec 2010
Location: Germany, Frankfurt
Posts: 30
brush51 is on a distinguished road
Default

it should work with the following line, right? :

Code:
	[[self navigationController] pushViewController:[[TableDetailViewController alloc] initWithNibName:@"TableDetailViewController" bundle:nil] animated:YES];
But nothing happens.

Iam searching since 8 days and i didn't find anything that works!
Please help.

How can I switch the View after imagepickercontroller didfinishpickingmediawithinfo ???
brush51 is offline   Reply With Quote
Old 01-02-2011, 01:21 PM   #7 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

really i don't understand your problem, you want to push (add) a view to your navigation controller? if so, yes, it is the way. If you want to switch a view (switch = change) no. if you want to change tabbar button selected, again no, it is no the way.

Post sample app to show the problem.
__________________
dany_dev is offline   Reply With Quote
Old 01-02-2011, 01:38 PM   #8 (permalink)
Registered Member
 
Join Date: Dec 2010
Location: Germany, Frankfurt
Posts: 30
brush51 is on a distinguished road
Default

Quote:
Originally Posted by dany88 View Post
really i don't understand your problem, you want to push (add) a view to your navigation controller? if so, yes, it is the way. If you want to switch a view (switch = change) no. if you want to change tabbar button selected, again no, it is no the way.

Post sample app to show the problem.
At first my aim was to show the results after imagePickerController:didFinishPickingMediaWithInf o in the other Tab, which includes a NavigationController and TableView, on the view when you click on a Cell of the TableView.

Now i think its enough to show a preview in another XIB for seconds.

For Tab Change: [self.tabBarController setSelectedIndex:NumberOfTabBarItem]


Here is my method:
Code:
- (void) imagePickerController: (UIImagePickerController*) reader
 didFinishPickingMediaWithInfo: (NSDictionary*) info
{
	
    // ADD: get the decode results
    id<NSFastEnumeration> results =
	[info objectForKey: ZBarReaderControllerResults];
    ZBarSymbol *symbol = nil;
    for(symbol in results)
        break;
	
	TableDetailViewController *tc = [[TableDetailViewController alloc] initWithNibName:@"TableDetailViewController" bundle:nil];
	tc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
	[self presentModalViewController:tc animated:YES];
	[tc release];	
	
	
	[reader dismissModalViewControllerAnimated: YES];
}
Or should i upload my whole project?
brush51 is offline   Reply With Quote
Old 01-02-2011, 01:55 PM   #9 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

yes, if you can create a sample app that represent the problem is best.

Code:
	[[self navigationController] pushViewController:[[TableDetailViewController alloc] initWithNibName:@"TableDetailViewController" bundle:nil] animated:YES];
here you are leaking TableDetailViewController, however self.navigationController point to your "real" navigationController? check it.
__________________
dany_dev is offline   Reply With Quote
Old 01-02-2011, 02:13 PM   #10 (permalink)
Registered Member
 
Join Date: Dec 2010
Location: Germany, Frankfurt
Posts: 30
brush51 is on a distinguished road
Default

here a sample app

link:
Free Files Hosting - Woofiles.com - No Registration Required
brush51 is offline   Reply With Quote
Old 01-03-2011, 03:28 AM   #11 (permalink)
Registered Member
 
Join Date: Dec 2010
Location: Germany, Frankfurt
Posts: 30
brush51 is on a distinguished road
Default

Hey dany88,

i have found the mistake in my code.

Code:
- (void) imagePickerController: (UIImagePickerController*) reader
 didFinishPickingMediaWithInfo: (NSDictionary*) info
{
	
    // ADD: get the decode results
    id<NSFastEnumeration> results =
	[info objectForKey: ZBarReaderControllerResults];
    ZBarSymbol *symbol = nil;
    for(symbol in results)
        break;
	
	TableDetailViewController *tc = [[TableDetailViewController alloc] initWithNibName:@"TableDetailViewController" bundle:nil];
	tc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
	[self presentModalViewController:tc animated:YES];
	[tc release];	
	
	
	[reader dismissModalViewControllerAnimated: YES];
}
Can you see it?

It is not possible to set more then one view as animated:YES, right?

so the right way to switch the view is this:
Code:
- (void) imagePickerController: (UIImagePickerController*) reader
 didFinishPickingMediaWithInfo: (NSDictionary*) info
{
	
    // ADD: get the decode results
    id<NSFastEnumeration> results =
	[info objectForKey: ZBarReaderControllerResults];
    ZBarSymbol *symbol = nil;
    for(symbol in results)
        break;
	
[reader dismissModalViewControllerAnimated: NO];

	TableDetailViewController *tc = [[TableDetailViewController alloc] initWithNibName:@"TableDetailViewController" bundle:nil];
	tc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
	[self presentModalViewController:tc animated:YES];
	[tc release];	
	
}

Thanks for your help, and i find it my way : )))

I hope this thread can help others which do the same mistake,
brush51
brush51 is offline   Reply With Quote
Old 09-22-2011, 08:09 AM   #12 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 15
macx3dant is on a distinguished road
Default

Quote:
Originally Posted by brush51 View Post
Hey dany88,

i have found the mistake in my code.

Code:
- (void) imagePickerController: (UIImagePickerController*) reader
 didFinishPickingMediaWithInfo: (NSDictionary*) info
{
	
    // ADD: get the decode results
    id<NSFastEnumeration> results =
	[info objectForKey: ZBarReaderControllerResults];
    ZBarSymbol *symbol = nil;
    for(symbol in results)
        break;
	
	TableDetailViewController *tc = [[TableDetailViewController alloc] initWithNibName:@"TableDetailViewController" bundle:nil];
	tc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
	[self presentModalViewController:tc animated:YES];
	[tc release];	
	
	
	[reader dismissModalViewControllerAnimated: YES];
}
Can you see it?

It is not possible to set more then one view as animated:YES, right?

so the right way to switch the view is this:
Code:
- (void) imagePickerController: (UIImagePickerController*) reader
 didFinishPickingMediaWithInfo: (NSDictionary*) info
{
	
    // ADD: get the decode results
    id<NSFastEnumeration> results =
	[info objectForKey: ZBarReaderControllerResults];
    ZBarSymbol *symbol = nil;
    for(symbol in results)
        break;
	
[reader dismissModalViewControllerAnimated: NO];

	TableDetailViewController *tc = [[TableDetailViewController alloc] initWithNibName:@"TableDetailViewController" bundle:nil];
	tc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
	[self presentModalViewController:tc animated:YES];
	[tc release];	
	
}

Thanks for your help, and i find it my way : )))

I hope this thread can help others which do the same mistake,
brush51



Thank you "tons" for the anwser of this thread, brush51!!!!
I was developing an app using ZBar SDK than meet up with this problem, too. Because of your hard work, I finally figured out where's the problem why mine is STOCKED ;D

Here I still have another problem, which is I need to open different ViewControllers. How should I coding to make it to check TextView's String
to make it open ViewControllers?


Here's my code:
- (void) imagePickerController: (UIImagePickerController*) reader didFinishPickingMediaWithInfo: (NSDictionary*) info
{
// ADD: get the decode results
id<NSFastEnumeration> results = [info objectForKey: ZBarReaderControllerResults];
ZBarSymbol *symbol = nil;


for(symbol in results)
// EXAMPLE: just grab the first barcode

break;

resultText.text = symbol.data;

resultImage.image = [info objectForKey: UIImagePickerControllerOriginalImage];

[reader dismissModalViewControllerAnimated: NO];


-----------------------Problem from here
switch() <-------------??
{
case 0:
NSLog(@"http://www.xxx01.com");
Company1VC *company1VC = [[Company1VC alloc] initWithNibName:@"Company1VC" bundle:nil];
company1VC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:company1VC animated:YES];
[company1VC release];
break;
case 1:
NSLog(@"http://www.xxx02.com");
Company2VC *company2VC = [[Company2VC alloc] initWithNibName:@"Company2VC" bundle:nil];
company2VC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:company2VC animated:YES];
[company2VC release];
break;
}

}

-------------------> End with Question. Thanks
macx3dant is offline   Reply With Quote
Old 09-23-2011, 07:00 AM   #13 (permalink)
Registered Member
 
Join Date: Dec 2010
Location: Germany, Frankfurt
Posts: 30
brush51 is on a distinguished road
Default

Sorry i dont really understand your question but to check the string from the textview u can do it like in textfields:

NSString *text = textView.text;
brush51 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 378
8 members and 370 guests
chemistry, daudrizek, jeroenkeij, Kirkout, PavelMik, whitey99
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,665
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, daudrizek
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:02 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0