Objective c 如何在imagePickerController:didFinishPickingMediaWithInfo之后更改视图(XIB)?
我是iphone和objective-c开发的新手 我想知道相机拍照后如何更改视图(XIB文件) 有人能帮我或分享一些代码吗?我从一周前开始搜索:( 完成应用程序后,我准备分享我的项目和/或制作教程 关于我的应用程序的信息:我想扫描条形码并将条形码保存在我的应用程序中。 用于使用ZBARDK扫描条形码iam。 我有一个Tabbar控制器,在第一个选项卡上,我可以打开相机。 扫描过程结束后,我想跳转到第二个选项卡(另一个XIB文件)并显示结果 谢谢你的帮助 这里是第一个选项卡(ScanCodeViewController)的代码: hObjective c 如何在imagePickerController:didFinishPickingMediaWithInfo之后更改视图(XIB)?,objective-c,uiimagepickercontroller,iphone,presentmodalviewcontroller,Objective C,Uiimagepickercontroller,Iphone,Presentmodalviewcontroller,我是iphone和objective-c开发的新手 我想知道相机拍照后如何更改视图(XIB文件) 有人能帮我或分享一些代码吗?我从一周前开始搜索:( 完成应用程序后,我准备分享我的项目和/或制作教程 关于我的应用程序的信息:我想扫描条形码并将条形码保存在我的应用程序中。 用于使用ZBARDK扫描条形码iam。 我有一个Tabbar控制器,在第一个选项卡上,我可以打开相机。 扫描过程结束后,我想跳转到第二个选项卡(另一个XIB文件)并显示结果 谢谢你的帮助 这里是第一个选项卡(ScanCodeVi
在
did完成PickingMediaWithInfo
中,您应该调用[self.tabbar controller setSelectedIndex:1]
切换到第二个选项卡。明白了
无法设置更多动画:是。
下面是示例和正确的代码
我希望它能帮助别人
- (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];
}
-(无效)imagePickerController:(UIImagePickerController*)读卡器
didFinishPickingMediaWithInfo:(NSDictionary*)信息
{
//添加:获取解码结果
id结果=
[信息对象forkey:ZBarReaderControllerResults];
ZBarSymbol*符号=nil;
用于(结果中的符号)
打破
[reader dismissModalViewControllerAnimated:否];
TableDetailViewController*tc=[[TableDetailViewController alloc]initWithNibName:@“TableDetailViewController”捆绑包:nil];
tc.ModAltTransitionStyle=UIModAltTransitionStyleFlipHorizontal;
[自我呈现ModalViewController:tc动画:是];
[tc释放];
}
brush51非常感谢您的回答。您能告诉我如何在imagePickerController:didFinishPickingMediaWithInfo:之后显示XIB文件吗?我的目标是加载另一个XIB文件,并在加载的XIB文件中显示捕获的图片和编码代码
#import "ScanCodeViewController.h"
@implementation ScanCodeViewController
@synthesize img;
@synthesize output;
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[img release];
[super dealloc];
}
- (IBAction) scanButton {
NSLog(@"Scanbutton wurde geklickt!");
ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
ZBarImageScanner *scanner = reader.scanner;
[scanner setSymbology: ZBAR_I25 config: ZBAR_CFG_ENABLE to: 0];
[self presentModalViewController:reader animated: YES];
[reader release];
}
- (void) imagePickerController: (UIImagePickerController*) reader
didFinishPickingMediaWithInfo: (NSDictionary*) info
{
NSLog(@"Entered imagePickerController");
// ADD: get the decode results
id<NSFastEnumeration> results = [info objectForKey: ZBarReaderControllerResults];
ZBarSymbol *symbol = nil;
for(symbol in results) {
break;
}
img.image = [info objectForKey:UIImagePickerControllerOriginalImage];
[reader dismissModalViewControllerAnimated: YES];
//[self presentModalViewController:output animated:YES]; //by using this, app chrashes
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[picker dismissModalViewControllerAnimated: YES];
}
@end
#import <UIKit/UIKit.h>
@interface OutPutCodeViewController : UIViewController {
IBOutlet UIImageView *resultImage;
IBOutlet UITextField *resultText;
}
@property (nonatomic, retain) IBOutlet UIImageView *resultImage;
@property (nonatomic, retain) IBOutlet UITextField *resultText;
@end
#import "OutPutCodeViewController.h"
@implementation OutPutCodeViewController
@synthesize resultImage;
@synthesize resultText;
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[resultImage release];
[resultText release];
[super dealloc];
}
@end
- (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];
}