Hi all,
The app is a viewbased project type. I am using a NSObject in a View XIB(UIView Nib), assume this object to be the topbar of the app.
MainController UIViewController loads the initial screen. it looks like this,
UIViewController MainViewController Image
i wanted to load a Top view(new one, call it X) Designed separately in the topbarview(red colour) in the above image.
Now,I have NSObject which resides inside "X" and binds all the events and have full control over X, its a singleton object.
in the NSObject Class i have a method to return the self object instance and a instance of uiview("X") it controls.
The methods are ,
-(UIView*)ReturnTopBarView
{
NSLog(@"called 2");
return topBarObject.topBarView;
}
//Provides the top bar instance to all the view controllers.
//Singleton Implementation.
+ (id)GetTopBarObject
{
if(topBarObject == nil)
{
NSLog(@"called 1");
return [[TopBarObject alloc] init];
}
return topBarObject;
}
The topbarview is the fully designed topbarview("X") which has to come in the main view controller's topbarview(red color segment in the image above).
i wrote a method in the main view controller as :
-(void)SetHomeScreen
{
self.topView = [[TopBarObject GetTopBarObject] ReturnTopBarView];
}
i invoke the -(void)SetHomeScreen
in my appdelegate.applicationdidfinishlaunching as [viewcontroller SetHomeScreen]
This actually calls the corresponding methods in the NSObject(TopBarObject class), but i dont see the view updated in (mainviewcontroller.topbarview). This is the main issue now.
i have a custom top bar and custom bottom bar with images and icons. So i chose this way of designing. I am not sure whether this is the best way, I am just seeking for a most optimal system design to make this work efficient. If you think there is some other way which is far far good than this please share it with me.