Monday, 9 September 2013

Creating a global UIView

Creating a global UIView

I am trying to create an application with a feature similar to facebook's
chat bubbles.
When the user navigates to a certain page (InCallViewController), they can
connect to another person via video chat. When they navigate out of this
page after connecting, I would like the video view to stay floating on the
screen, but allow them to do what ever they want to do in the app.
In order to do this, I have made an InCallViewController class, which will
allow the user to connect with the other person. Once connected, the video
is displayed in a view. This view is movable (similar to facebook's chat
bubbles) and displays the video chat perfectly, however when I exit the
page and go to another page (AccountViewController) in the app, I am
unable to keep this view on the screen. I have tried many things,
including setting this view as a subview in the later pages. However when
I do this, the subview is not displayed.
MyAccountView.m
- (void)viewDidLoad
{
[super viewDidLoad];
InCallViewController *inCallViewController = [[InCallViewController
alloc] initWithNibName:@"InCallViewController" bundle:nil];
[self.view addSubview:inCallViewController.previewView];
[self.view bringSubviewToFront:inCallViewController.previewView];
(Do some other set up stuff)
}
InCallViewController.h
@interface InCallViewController : UIViewController <UIAlertViewDelegate>
{
CGPoint currentTouch;
NSArray *viewArray;
AVAudioPlayer *audioPlayer;
}
@property (weak, nonatomic) IBOutlet UIView *previewVideoView;
The previewView is a UIView in the InCallViewController class. This is
hooked up in the IB, and works perfectly when in the InCallController
class. The problem is, it won't show up when adding it as a subview in
another class. I am wondering what I am doing wrong, or if there is a
better way to keep the "previewView" remaining on the screen after I exit
InCallViewController.
Thanks

No comments:

Post a Comment