Hi PalNor, and welcome to the Dev Forum!
I'm having some difficulty following your code because I can't tell which identifiers refer to a class, and which refer to an object of that class. I would recommend making sure your identifiers follow the Obj-C convention of capitalizing the first letter of a class name, and beginning the identifier of an object with a lower case letter. For example:
@interface SecondViewController : UIViewController <UITabBarDelegate> {
// upper case // lower case
ActivityViewController *activityViewController;
WebViewController *webViewController;
UIViewController *currentViewController;
UITabBar *myTabBar;
}
@property (nonatomic, retain) ActivityViewController *activityViewController;
@property (nonatomic, retain) WebViewController *webViewController;
@property (nonatomic, assign) UIViewController *currentViewController;
@property (nonatomic, retain) IBOutlet UITabBar *myTabBar; // <-- connect to the tab bar in IB
@end
There are also several lines that don't make any sense. E.g.:
if (SecondViewController.ActivityViewController == nil) // ...
If the above is inside the @implementation of SecondViewController, you would refer to the activityViewController instance variable as 'self.activityViewController' (assuming the identifier of that ivar starts with a lower case letter as shown in the @interface example). So I would expect that line to look like either of the following:
if (self.activityViewController == nil) // ...
// or:
if (activityViewController == nil) // ...
Most of the errors I see at first glance seem to be related to some confusion over the difference between a class and an instance of a class. There also seems to be some confusion over the view hierarchy. These are fundamental problems that will cause your program to fail regardless of how you're switching views. So if we can assist you further, I'd recommend starting your own thread. In that case, please include SecondViewController.h, as well as another copy of SecondViewController.m which is properly formatted.
To format your code please refer to the announcement which is the first topic of the forum. You can see how your post will appear by clicking on the Preview tab above the Reply editor panel.
- Ray