How to add tabbar in cameraView of zbar sdk - iphone

I'm a newbie in iphone app developing, I just started learning two weeks ago due to the need of my final project.
So please forgive me if my question seems really stupid.
I've searched in forums and zbar documentation about how to customize the cameraView.
But I still didn't have a clear understanding about how to do it.
Now I'm trying to add tabbar into the cameraView, could anybody tell me how to do it?
I know that I need to use overlay and create my own view, adding the reader as a subview in it. Could anybody give me some direction more explicitly about how to reaise it?
Thanks in advance!!

You have to create your own custom UITabBarController class. And add this controller in your custom camera view. and custom camera view is created by the AVFoundation framework.

From what I know, you need to add the tabbar to the appDelegate and then inner views within each tab. Therefore you would have within the appdelegate applicationDidFinishLoading method
// Add the tab bar controller's view to the window and display.
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
of course, you need to declare it in the appdelegate.h file
#interface AppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
UIWindow *window;
UITabBarController *tabBarController;
}
#property (nonatomic, retain) IBOutlet UIWindow *window;
#property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
Search for tabBar tutorials. They must be created BEFORE any NAVIGATION Controller.
Then place all your zbar code in the first view controller.

Related

steps to add tabbarcontroller to AppDelegate using Interface Builder in XCode 4.2 Empty Application template

while I'm stuck at this question I cannot find the right steps to add a UITabBarController to the AppDelegate (not programatically) but by using interface builder for the "Empty Application" template, I tried to add a new empty xib file, then dropped uitabbarcontroller into it, but there is no way to link it (from IB) to AppDelegate !! i.e. when I move the blue line from tabbarcontroller object (in document outline) to File's Owner, interface builder shows only the "Delegate" option in the shown list so there is no IBOutlet option in there.
so, what are the exact steps for adding a tabbarcontroller and connect it to appDelegate using the interface builder way (for the Empty Application template, using XCode 4.2 and IOS 5 SDK) ?
step1: create new Empty Application template project.
... waiting for the next steps...
thanks so much in advance.
Step 1: create new Empty Application template project.
Step 2: add
#property (nonatomic, strong) IBOutlet UITabBarController *tabBarController;
#property (nonatomic, strong) IBOutlet UIWindow *window;
in your app delegate. (dont forget to synthesize these)
Step 3: change this line in your app delegate:
#interface AppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate>
Step 4: modify this method
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self.window addSubview:[self.tabBarController view]];
[self.window makeKeyAndVisible];
return YES;
}
Step 5: create a new empty xib. Drag a tab bar controller on to it as well as an empty object.
Set the empty object's class to AppDelegate. Set Files Owner to UIApplication.
Step 6: drag the 'delegate' property from your files owner on to your appdelegate class and drag the tab bar outlet from you appdelegate class to your tabbarcontroller
Step 7: Add a window and drag the 'window' connection from your appdelegate to the window.
Step 8: Dont forget to go into the project settings and set the main-base nib file to the new xib you created.
Thats it. Hope I didn't miss anything.
I don't understand what is the need to add a UITabBarController through the main window. With Xcode 4.2, Apple has made some changes in the default templates. It does not provide a MainWindow.xib in the Empty Application. That is why, if you open up the AppDelegate.h, you will see:
#property (strong, nonatomic) UIWindow *window;
It does not have an IBOutlet for the window as we used to see in previous Xcode versions.
What you want to achieve is a UITabBarController with Core Data support. You could add the tabBarController programatically, and still add CoreData support.
Here's what I had to do.
From your storyboard's Objects list (Controllers & Objects) in the Utilities panel, drag over a generic "Object" (yellow cube) to your Tab Bar Controller Scene page (I place the object under the "Exit" object).
Set the class of the object to your appDelegate. Now you should be able to link your Tab Bar Controller's delegate to your appDelegate object. You can also link the appDelegate to the Tab Bar Controller if you've created a property such as
#property (weak, nonatomic, readwrite) IBOutlet UITabBarController *tabs

IOS 5 Using App Delegate To Load a Modal

i'm building an app for ios5 and i have the following problem:
In ios4 when i need to present a login modal view on app start i do the following:
in the AppDelegate i load it in method didFinishLaunchingWithOptions using the referenced View Controller.
#interface MyAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate,LoginViewControllerDelegate> {
UIWindow *window;
UITabBarController *tabBarController; //THIS
UIView *splashView;
User *user;
}
But now, in ios5 using storyboards, i can't find how to do this because in my AppDelegate i don't have any reference to any view controller and i don't know how to get them.
Any idea about this?
Thanks
But why don't you just add a new Tabviewcontroller in MainStoryboard?
Using storyboards is much easier than writing a code in AppDelegate.

Loading Tab Controller View in Window Based iPhone App

I am learning how to create apps with multiple views using the Window-based application template. I am trying to implement a tab bar but when my view loads, it is a blank. I realize it could be an issue between versions of iPhone SDK or Xcode. I am using the latest version of both (iOS 4.3 and Xcode 4.0).
My current code is as follows:
.h file:
#interface iBountyHunterAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
UITabBarController *tabcontroller;
}
#property (nonatomic, retain) IBOutlet UIWindow *window;
#property (nonatomic, retain) IBOutlet UITabBarController *tabcontroller;
.m file:
#synthesize window;
#synthesize tabcontroller;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after app launch
[window addSubview:tabcontroller.view];
[window makeKeyAndVisible];
}
In the sample code I downloaded, this worked fine. I can't figure out where the problem is and any suggestions would be greatly appreciated.
Have you added any view controllers to the tab bar controller? The tab bar controller doesn't have any content of its own, other than the tab bar itself. You need to add your own view controllers using -setViewControllers:animated:.
So I think I figured it out. Due to the lack of the UIWindow *window in the ApplicationDelegate.h #interface:
I had to reference [self.window addSubview:tabcontroller.view]; in my application didFinishLaunching method,
rather than just [window addSubview:tabcontroller.view];
Thanks for the assistance.

Objective-C Novice. Change property in Controller from another Controller?

The context: I have three views. One Introductory view, an Upload view and the Main view. As classes (With their respective headers) I have the rootViewController (SwitchViewController), IntroViewController and UploadViewController. The first view to be shown is IntroView. The user presses a button (declared in SwitchViewController) that takes them to the UploadView, then in the UploadView they get to choose an image and press the button again to go back to IntroView.
The thing is that while the user gets to pick the image with UIImagePickerController the button to switch views won't hide nor a UIImageView I have with a logo on top of the view(screen). The UIImageView and the UIButton are both declared in SwitchViewController's header.
The code used:
UploadViewController.h
#import [...] //Imports
#class SwitchViewController;
#interface UploadViewController :
UIViewController <UIImagePickerControllerDelegate,
UINavigationControllerDelegate,UIActionSheetDelegate> {
UITextField *imageTextField;
UIImageView *uploadedImage;
SwitchViewController *switchViewController;
[...]
}
#property (nonatomic, retain) SwitchViewController *switchViewController;
#property (nonatomic, retain) IBOutlet UITextField *imageTextField;
#property (nonatomic, retain) IBOutlet UIImageView *uploadedImage;
[...]
#end
UploadViewController.m
[...]
- (IBAction) selectImageButtonPressed {
self.switchViewController.submitButton.hidden = YES;
self.switchViewController.imageLogo.hidden = YES;
[...] //continues
I just begun recently programming in objective-c so please forgive me if the question is very essential. I have looked and am following "Beginning iPhone 3 Development" of APRESS. But even if it helps to greatly understand the basics sometimes I get lost.
PS: If it is clearer to answer the question the SwitchViewController.h and .m snippet codes can be provided if asked. But I thought this text is big as it is.
#Joze i think I may have understood your problem switchViewController is a variable of the class UploadViewController so if you do anything with that variable it wont affect the switchViewController view. so when you are calling the switchViewController view at that time you have to do initWithNibName: bundle: and then hide the button and imageView and also you need to do something like switchViewController.delegate = self; and then call the view modally or what ever way you want it.
PS. i m not sure the that spelling is correct. i dont have xcode at my home.
I hope your problem solves with this.
I solved my problem after refactoring the whole code and changing the general structure of the program itself. Now I have 3 views and each with a viewController to control it. All the switching of views occurs in the Delegate since he has access to everyone. That way I can control every property with every controller, without much difficulty. Changing the property of one of the objects present in one view from another view is difficult and rather inconvenient if not sometimes impossible.
The approach I took when asking this question was short sighted for the application that had to be done. I thank all those who tried to help.

iPhone Development - multiple views in one window.

I want to have a UIView at the top half of my app, and a UITable at the bottom half. If I create a basic window application I can do this using IB. My main problem is that I seem to be only to do this in the delegate file which I would like to avoid.
I repeat the exact same steps I did in delegate in a separate controller and all I get is a blank screen.
0#interface RootViewController : UIWindow {
UIWindow *myWindow;
UIView *headerView;
UITableView *tableView;
}
#property (nonatomic, retain) IBOutlet UIView *headerView;
#property (nonatomic, retain) IBOutlet UITableView *tableView;
#property (nonatomic, retain) IBOutlet UIWindow *myWindow;
#end
I have each of these connect to the right view in rootviewcontroller.xib
I was wondering if anyone had any advice / snippets / examples I could use?
You need to use both the delegate file and Interface Builder. Interface Builder makes a view that binds to your delegate through IBOutlets and IBActions. I would run through several iPhone tutorials found on google before continuing.
Your RootViewController certainly shouldn't be a subclass of UIWindow. You probably want UIViewController for that.