w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Adding subview to superview shared by a container view resizes container view
When you're using auto layout, you can't set the frames of views you load from a xib or storyboard. Auto layout sets the frames, and it ignores changes you make to the frames. You need to update the constraints on those views if you need to move or resize them directly. You can create an outlet pointing to an NSLayoutConstraint in your view controller, and connect the outlet to the appropriate constraint in your xib or storyboard. Then you can change the constraint's constant property to change the view's position or height.

Categories : IOS

How can I display a container and list in a Sencha Touch 2.2 view and have the whole view scrollable?
You have to set a specific list height in order to let it show. If you doesn't know the final height of the list, try to get it: attach this handler to your list: listeners: { painted: function() { this.setHeight(this.itemsCount*this.getItemHeight()); } }

Categories : Javascript

pushing a ViewController from a Container View changes its view frame to original size
What you say you're doing isn't possible. You can't do a push if your controller isn't embedded in a navigation controller. If you embed Child View 1 in a navigation controller, what you're trying to do should work.

Categories : IOS

How to use a Button in Container View's Navigation Controller to go back to last view
If you are using [self presentViewController:yourVC animated:YES completion:nil]; to present your View Controller, then you should use [self dismissViewControllerAnimated:YES completion:nil]; to dismiss your present View Controller and to go back to the last View Controller.

Categories : Iphone

Why causes Container View to keep its child view's frame to match its bounds?
Setting up a test project and stepping through the code gives you a fairly clear idea of how this is implemented. The container view itself is a plain UIView. As part of the controllers loadView process, the container view is created with the constraints setup in the storyboard. The embedded controller segue is then performed. This creates the child view controller, which has its view added as a subview of the container view, and appropriate layout constraints setup so that the child view fills the container. Thats about it really.

Categories : IOS

iOS Scroll View, Container View - auto layout issue
Received the answer from Apple Tech support. It still gives me an error in Xcode, but it functions on 3.5" screens now. Here's the answer: I'm not sure why interface builder decided to relate the bottom of the container view to the bottom of the scroll view's content view minus 432. You can not remove this constraint because it is necessary for the layout to be fully defined [1]. However, if you promote that constraint to a user constraint, you can edit the constant value to zero. This will correct the issue where the bottom part of your content was being cutoff. In Interface Builder: 1) Select the Container View 2) Switch to the Size inspector 3) Click the gear icon next to the "Bottom Space to: Superview; Equals: -432.0" constraint. 4) Choose Select and Edit from the menu. 5) Enter

Categories : IOS

Not getting Button click event in View added in Container View
I think you should try by bringing your subview(i.e. view1) to front, since it is getting hide by another subview (i.e. view2) You should first try with [self.view bringSubviewToFront:self.commonView.containerView ]; only. if this works then it's Good otherwise try with this both shown as following [self.view bringSubviewToFront:self.commonView.containerView ]; [self.view bringSubviewToFront:view1]; Hope this is helpful to you! Enjoy Programming!

Categories : Iphone

how to add navigation item from view controller embedded in container view
The easiest way to do it is to create a delegate protocol in your embedded view controller that will be implemented by the parent view controller. Create a property on your child view controller of protocol type, when you create the child view controller (i suppose you are creating it from your parent view controller) set the parent view controller as the delegate. In the parent view controller, in the delegate method(s) add the code for adding the button. When you want to add the button just call from your child view controller the delegate method(s) and your parent view controller will handle the button that you want to add. If you are not familiar with delegate pattern or with protocols, there are a lots of tutorials on the internet or just check one of my previous answers that are

Categories : IOS

Accessing Container view controller from another Container view controller
You could link them togehter, by in the headers of StatInfoViewController add: @property (nonatomic, weak) MyCombinationsViewController* myCombinationsViewController And then when allocating them do the following: StatInfoViewController *stat = [storyboard instantiateViewControllerWithIdentifier:@"StatInfoViewControllerID"]; UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; MyCombinationsViewController *myComb = [storyboard instantiateViewControllerWithIdentifier:@"MyCombinationsViewControllerID"]; stat.myCombinationsViewController = myComb; myComb.view.frame = self.combinationsContainer.bounds; [self.combinationsContainer addSubview:myComb.view]; [self addChildViewController:myComb]; [myComb didMoveToParentViewController:self]; stat.view.fr

Categories : IOS

Android RelativeLayout: how to put a view below another view when both aren't at the same container
I think you can achieve this by using relative layout instead of linear layout. I have not tested it but it should work. <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:id="@+id/lotTopTitleBar" android:layout_width="match_parent" android:layout_height="50dp"> </LinearLayout> <LinearLayout android:id="@+id/lotFloatView" android:layout_width="120dp" android:layout_height="wrap_content" android:layout_below="@id/lotTopTitleBar"> <Button android:layout_width="match_parent" android:layout_height="60dp" android:background="@null" /> <Button an

Categories : Android

view in container view does not align properly
The problem was that the container view in which the VC on the left was embedded was sized to extend all the way to the bottom of its VC, overlapping the tab bar menu, because I hide the tab bar menu anyway, so I thought that was correct. But in fact, I needed the parent container view to extend only down as far as the top of the tab bar menu.

Categories : IOS

Autolayout of View Controller View in a Container
Use NSBoxes as containers. In your sidebar, add an NSBox inside the NSView and constrain all sides to the view. Then when you want to swap in a view for the side bar you can call container (the NSBox object) setContentView:.

Categories : Objective C

Qt/QML: Is it allowed to have a model view as a delegate?
The item in your base ListView delegate is sized to the window's height and width. I believe this would effectively hide any other delegates from the root level ListView because the first delegate would take up the entire screen.

Categories : Qt

View Controller not presenting from App Delegate
Actually this is the correct way of loading a ViewController from AppDelegate.. self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; DefaultViewController *viewController = [[DefaultViewController alloc] initWithNibName:@"DefaultViewController" bundle:nil]; self.window.rootViewController = viewController; [self.window makeKeyAndVisible];

Categories : Iphone

Best way to dismiss a modal view from app delegate
If you're using a navigation controller, you can easily access its topViewcontroller and check if it has presented another view controller from your application delegate class. Up until iOS 6.0, the accessor you'd like to use for that would be 'modalViewController', after that it's marked as deprecated, so you should use presentedViewController. An example of such a check would be something like this: // after rearranging view controller hierarchy, check for modal view controllers UIViewController *topVc = [navigationController topViewController]; if ([vc presentedViewController] != nil) { [vc performSelector:@selector(dismissModalViewControllerAnimated:) withObject:[NSNumber numberWithBool:YES] afterDelay:0.5]; } Invoking the dismissModalViewControllerA

Categories : IOS

open a new view inside app delegate
There are couple of ways to achieve it: First: AppDelegate has a property window. A window is a view, so you can do [self.window addSubview:newView]; Second: a view controller can reach the window without dealing with the app delegate. [controller.view addSubview:overlayView];

Categories : IOS

Don't know how to access a view object from my app delegate on iOS
You shouldn't be trying to - that isn't what the app delegate is for. Or, depending on the task, the state of the switch should be stored to user defaults or something like that. If the view controller should do that job, it can do this by observing the UIApplicationWillResignActiveNotification notification (if it really needs to be done then). If the app delegate should do the job then the view controller should update the value in NSUserDefaults whenever the switch is changed.

Categories : IOS

iOS Delegate Issue with multiple view controllers
Option 1: Cancel the operation in the child viewWillDisappear. Option 2: In the networkClass, check that the method is implemented before calling it. Option 3: (Code smell): Implement a stub in the parent. You should probably cancel the operation (Op.1) in any case. If you marked the functions as optional in the protocol definition you should definitely check for its existence (Op.2); if not, you should have received a compiler warning about an incomplete implementation. Don't ignore any compiler errors, especially about unimplemented methods! If it doesn't make sense to implement them fully, you should seriously consider whether they should be optional (2). You can, of course, implement stubs (-(void)callback1{}), but that is rarely the correct course of action.

Categories : IOS

About passing data between view controllers with delegate
Sorry, dont fully understand what you want .. but here is my take. FIRST SCENARIO: Why would you need to update the view that isnt on screen ? Just update in viewWillAppear. Otherwise you can have the delegate update it when you finish editing that textfield. SCENARIO 2: You need a link between the view controllers, use segues makes easy, set as delegate and pass along the info. Why make it harder than it needs to be Many things have delegates, textfields etc, you are just saying this class / obj will do something for something else. There are many youTubes about delegates, ie http://www.youtube.com/watch?v=eNmZEXNQheE For more info see this stack post - it covers everything you need to know Passing Data between View Controllers

Categories : IOS

Push View Controller from External Delegate
If you are using a navigation controller, just use this method: [self.navigationController pushViewController:(UIViewController *)viewController animated:(BOOL)animated];

Categories : IOS

Objective-C : present view controller from App Delegate above everything
You may have to use the active view controller to present this view and have each view listen for the notification while active. Are you using storyboards? Then you could do this differently. I haven't tried this so I am not positive.

Categories : Objective C

Pass scrollview delegate to child view controller
child is getting deallocated by the time the delegate method fires. From UIScrollView.h: @property(nonatomic,assign) id<UIScrollViewDelegate> delegate; // default nil. weak reference This is a weak reference, so it won't be retained. To fix it, create a strong @property in your main view controller, and set it to child.

Categories : IOS

Passing data between view controllers using protocol and delegate
Just a couple things I noticed in your code, your property should contain the specified protocol: @property (retain) id <PassString> delegate; And at some point in the class that's implementing the delegate methods, you have to assign the delegate to view controller 1. For example: [viewController2Instance setPassingDelegate:self];

Categories : Iphone

What to use as delegate and data source for a table view subview?
As you already noticed, creating whole UITableViewController is an unnecessary overhead. What you need is just to implement required methods of UITableViewDelegate and UITableViewDataSource protocols. Then instantiate UITableView, set its delegate and data source appropriately, and display it.

Categories : IOS

Simple delegate method or property on destination view controller
Delegation is commonly used for allowing the delegated object to communicate back to the master object, either for asking for additional data or for performing callbacks. There's no reason in your case not to immediately provide the delegated object with everything it needs, since you have it available already, so the second option would be the most reasonable way to go. Generally speaking, the delegation flow goes more or less like this Foo: "Hi Bar, here's a task for you. Use this data, and do your things" [later on] Bar: "Hey boss, this thing just happened!" Foo: "Oh, nice! Thank you for letting me know" [later on] Bar: "Hey boss, I'm gonna need something more to conclude the work" Foo: "Here is is" [later on] Bar: "Hey boss, I'm done! Here's th

Categories : IOS

Getting reference to the view of a container view
You are right about prepareForSegue. The destinationViewController will give you the destination view controller. I do not see why you would need anything else. If you want the destination controller to contain another controller (why?), you can give the destination controller a @property that points to that controller, and you can read and set this property. But the question remains -- why would you want to do that?

Categories : IOS

ARC: When is ephemeral view controller delegate memory reclaimed with weak reference
- (void)viewDidLoad { [super viewDidLoad]; BarViewController *bar = [[BarViewController alloc] init]; // does this assignment create a "strong" reference i.e. increase retain count by 1? NO, you set the delegate as weak so the compiler will not strongly point to any object (in this case SELF) when bar.delegate is assigned. bar is a local variable so it will automatically retain the BarViewController object as long as the functions does not return (increasing the count by 1 when assigned and deleting it when the function ends), or as long as you dont set it to NIL. If you do not specify the delegate var to be weak, then yes, you will increase the retain count to SELF by 1 and you might end up with retain cycle. That is way delegates should always be weak. bar.delegate = s

Categories : Objective C

Activate View for header delegate for specific section in single table
The other header names don't appear because the viewForHeader method only answers for section 2. Once implemented, the datasource expects that method to be the authority on all headers. Just add some else logic for the other sections.... - (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ UIView * headerView; UILabel *label; if (section==2) { headerView = [[[UIView alloc] initWithFrame:CGRectMake(1, 0, tableView.bounds.size.width, 40)] autorelease]; [headerView setBackgroundColor:[UIColor clearColor]]; // and so on return headerView; } else if (section == 0) { label = [[[UILabel alloc] initWithFrame:CGRectMake(0,0,tableView.bounds.size.width, 44)] autorelease]; label.text = @"Sectio

Categories : Iphone

Get container VC instead of view
Storyboards like to do everything in the prepareForSegue so just assign your segue an identifier. In this case we'll assume you set it to baseButtonContainerSegue in IB. Then in prepareForSegue use : - (void) prepareForSegue:(UIStoryboardSegue*)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"baseButtonContainerSegue"]) { self.liveContainer = segue.destinationViewController; } } Just make sure that you have a UIViewController property liveContainer, (specifically in your case you would want to have a BaseButtonContainerViewController property). I am not exactly sure why you have to do it this way but I am guessing it has something to do with memory management. Say you leave that screen and your containers are deallocated. Then when you go back you may l

Categories : IOS

How do I resize the container view?
I found a quick way to modify the sizes of the container view and the banner view by setting their frames instead of changing their constraints. In order for the changes to work, the new frames must conform to the constraints. And also, since these constraints are reapplied whenever the view appears, I had to set the frames at v viewDidLayoutSubviews. I would consider this to be a very hackish way of dealing with this problem. The recommended solution should still be to modify the constraints.

Categories : Iphone

Delegate types and covariance with a generic delegate type
The problem is the two delegate types simply aren't compatible. In order to make this work you are going to need to add an indirection layer which converts the arguments between ICommand and TCommand. public void RegisterHandler<TCommand>(CommandHandler<TCommand> handler) where TCommand : ICommand { mCommandHandlers.Add( typeof(TCommand), (command) => handler((TCommand)command); ); }

Categories : C#

Parent and child view in Container V
Your root view controller is not a MFSideMenuContainerViewController. It is a UITabBarController. If you want to use MFSideMenuContainerViewController you will want to check out the documentation: https://github.com/mikefrederick/MFSideMenu/ Here is a basic example: UIViewController *leftSideMenuViewController = [storyboard instantiateViewControllerWithIdentifier:@"leftSideMenuViewController"]; UIViewController *rightSideMenuViewController = [storyboard instantiateViewControllerWithIdentifier:@"rightSideMenuViewController"]; MFSideMenuContainerViewController *container = [MFSideMenuContainerViewController containerWithCenterViewController: self.window.rootViewController leftMenuViewController:

Categories : IOS

Do I need a ViewController container or a composite view?
Generally speaking, if I can avoid it I try not to subclass UIView and instead do everything within UIViewController subclasses. A controller is usually required anyway (model/view glue code, user interaction, delegate stuff, notification handling, etc.), so if no custom drawing is needed it is usually possible to do without a UIView subclass. In your case I could envision one reusable UIViewController subclass that represents a list entry. It has the following responsibilities: Create two alternate view hierarchies (collapsed/button, expanded/panel) Toggle between the view hierarchies in reaction to user interaction (with/without animation) And another UIViewController subclass that represents the entire list. It has the following responsibilities: Override the appropriate methods

Categories : IOS

UIActivityViewController inside a Container View
I'm not sure whether your app is designed for iPhone, iPad, or both, but Apple are very specific about how to display a UIActivityViewController. From their documentation: When presenting the view controller, you must do so using the appropriate means for the current device. On iPad, you must present the view controller in a popover. On iPhone and iPod touch, you must present it modally. If you're displaying it in some other way (i.e, in a container view controller) you may well encounter this sort of weird behavior. I'd recommend you display the activity view controller as recommended by Apple.

Categories : IOS

How to load xib into two Container Views within one view controller
In the storyboard, you can add two container views to the same view controller and connect them both with the same child view controller by right-click dragging and choosing embed. This created the segue like so: Click on the segue and give it an identifier. Then, add the prepareForSegue method to your parent view controller, and set some properties for the lap timers separately if you want. - (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segueName isEqualToString: @"embedSegueToLapTimerOne"]) { LapCounterNibViewController * childViewController = (LapCounterNibViewController *) [segue destinationViewController]; [childViewController setFoo:bar1]; } if ([segueName isEqualToString: @"embedSegueToLapTimerTwo"]) { LapCounter

Categories : IOS

How do I pass data from my ViewController to a Container View?
You can use prepareForSegue just like any other two controllers -- that method will be called after the two controllers are instantiated, but before either viewDidLoad runs. The other way to do this is to use the parent controller's childViewControllers property (the embedded controller is a child). So, the child will be self.childViewControllers[0]. After Edit: - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"EmbedSegue"]) { MyEmbeddedController *embed = segue.destinationViewController; embed.labelString = self.stringToPass; } } Of course, you have to change the names to what you have. Make sure the name you give to the segue in IB matches the one you check for in the if statement. In this example

Categories : IOS

ViewDidLoad not called when adding to Container View
The viewDidLoad: method is called when the view property is accessed for the first time. I assume that in your case view == tableView. If not, you have to adjust the loadView method of your child VC. - (void)loadView { //create your table view here //... self.view = self.tableView; } Then just use view property instead of tableView. _workoutView = _workoutVC.view; EDIT: The full code would be: _workoutVC = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"entryTableVC"]; _workoutView = _workoutVC.view; [self addChildViewController:_workoutVC]; [_workoutView setFrame:_container.bounds]; [_container addSubview:_workoutView];

Categories : IOS

iOS Container View doesn't honour intrinsicContentSize
Auto layout uses the intrinsicContentSize property. If you're not using auto layout, the system will not ask any view for its intrinsicContentSize. The pink view will be forced to the size of the container view unless you write some code. This is true whether you are using auto layout or not. This is just the way container views created in a storyboard work. The system will not ask your pink view for its intrinsicContentSize. Since you imply that you're not using auto layout, here's one way you can make the container view be the intrinsicContentSize of its content view. Make a subclass of UIView called CameraContainerView and set this as the custom class of the container view. Override addSubview: in this new class: @implementation CameraContainerView - (void)addSubview:(UIView *

Categories : IOS

NSLayoutConstraint subviews won't autoresize to fit container view
I'm surprised you're setting the frame for a view. Generally in auto layout, you'd slide in the view by changing a constraint constant, not by changing a frame. For example, imagine that your constraints for the container's subviews are defined like so (for simplicity's sake, since the two views are supposed to take up 50% of the container, most easily done by defining the two subviews to be the same height): [containerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[topView][botView(==topView)]|" options:0 metrics:nil views:views]]; [containerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[topView]|" options:0 metrics:nil views:views]]; [containerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[botView]|" option

Categories : IOS

How do I add a bottom line to a container having list view?
Would it not be easier to code it as follows: <RelativeLayout> <RelativeLayout android:id="@+id/top_bar_container" android:layout_width="match_parent" android:layout_height="48.5 dp" android:layout_alignParentTop="true" android:background="@color/background_action_bar" android:orientation="horizontal" > <!-- Stuff for the top bar --> </RelativeLayout> <FrameLayout android:id="@+id/fragment_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/top_bar_container" > <!-- Stuff for the Frame --> </FrameLayout> <RelativeLayout android:id="@+id/bottom_bar_container"

Categories : Android



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.