w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Pushing a view to a UINavigationController that's not in the same view hierarchy
If it helps you, here is a workaround I used to get rid of some push issues from subviews. I use a modal segue, with push animation. You can call them like: [myAnimations modalRight:self destvc:yourDestViewController]. To segue back, from yourDestViewController: [myAnimations modalLeft:self]; myAnimations.h #import <Foundation/Foundation.h> @interface myAnimations : NSObject @end myAnimations.m #import "myAnimations.h" #import <QuartzCore/QuartzCore.h> @implementation myAnimations +(void) modalRight:(UIViewController*)vc destvc:(UIViewController*)viewCtrl{ CATransition *transition = [CATransition animation]; transition.duration = 0.3; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; transition.typ

Categories : IOS

UILabel in view 2 Displaying UITextField text in view 1
Not quite sure how you are pushing your view controllers, but here is how you capture the value from one view controller to other. If you are using storyboard, you can use prepareForSegue:sender: in view controller 1: - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString @"some string"]) { SecondViewController *vc = [segue destinationViewcontroller]; [[vc label] setText:@"SomeText"]; } } If you are not using storyboards, you can invoke your method before presenting or pushing your second view controller: - (void)someMethod { SecondViewController *vc = [[SecondViewController alloc] initWithNibName:@"somexib" bundle:nil]; [[vc label] setText:@"sometext"]; [self presentViewController:vc anima

Categories : Iphone

ViewController in UINavigationController not filling view
Try to remove the following line: self.view.translatesAutoresizingMaskIntoConstraints = NO; This will let the view controller view to have its full width and height according to the default autoresizing masks it has. This is what I get (I set the background color of the view to be green): If the line above is still added, this is what I get (which seems to imply the view is not found anywhere since there is no trace of green color):

Categories : IOS

set frame viewcontrollers view in UINavigationController
Do not subclass UITAbleViewController for this purpose. You are far better off with having a UIContainterView located at (0, 195, 320, 500) and a regular UITableViewController (or AZControlViewController, respectively that parts of AZControlViewController that control the talbe view) within. Its table view's frame would be (0,0,320,500).

Categories : IOS

Pushing a View Controller using another UINavigationController
You should have one class (possibly the app delegate) which creates your container structure. It has access to the view controllers that are created. Your table view controller and navigation controller may not both exist initially but the class which creates everything initially should 'build the bridge' between the structures by passing a reference of the navigation controller or the content view controller to the table view controller or the menu view controller. That reference should be stored in a property and will allow you to cleanly present your view controller. This kind of setup is preferable to navigating through parentViewController or similar links as that will lead towards tying you to a particular structure in a non-transparent way. Or, in your storyboard, you can just a

Categories : IOS

Move UINavigationController inside a UITabBarController to first view
I;n this line, you're saying that you want to access the UINavigationController that contains your tab controller. UINavigationController *nav = (UINavigationController *)tabb.navigationController; However, it appears you want to access the Navigation Controller that is contained IN the tab controller. Since it is the first controller you can access it like so: UINavifationController *nav = (UINavifationController *)[tabb.viewControllers objectAtIndex:0];

Categories : IOS

Run UIViewController inside UINavigationController as a second view of UISplitViewController
I fixed it. Turned out, that I had to move my code from ViewDidLoad method to ViewDidAppear and it worked fine. viewDidLoad is getting called before the navigationController property has been updated, that was my mistake.

Categories : IOS

Dismissing view in UINavigationController and at the same time syncing
I think I would make a central place for the Items. Lets call it a ItemsStore. ItemsStore is a singleton that has the responsibility to have a set of the latest items and give access to the items. It also fires notifications if new data arrives, or old data is saved. In this case: View 2 adds the data to the store. The store notifies that there are changes. View 1 updates on the notification. View 2 also asks the ItemsStore to save the data to the server. I would not give the responsibility of loading and saving to the controllers, it will get ugly and complex.

Categories : IOS

Object for view not being passed if initiated in UINavigationController
Check that your currentUser property declared like this: @interface ProfileViewController : UIViewController @property (nonatomic, strong) Contact * currentUser; @end

Categories : IOS

connect class with root view controller (UINavigationController)
It is a UITableViewController. So make your ViewController extending UITableViewController. or drag and drop a UIViewController and write the class. Go to ViewController.h It should show :@interface ViewController : UIViewController Make it : @interface ViewController : UITableViewController Once you have made this change you will be able to select 'ViewController' in interface builder as the Class.

Categories : IOS

UINavigationController & Auto-Layout: RootViewController's view is not shown
I just had to modify my viewDidLoad: -(void)viewDidLoad{ [super viewDidLoad]; // Generate all subviews and their constraints UIView *view = [RuiObjectManager viewForParentViewDescription:_parentViewDescription]; self.title = @"Hello"; // Add generated view to self.view and create constraints [self.view addSubview:view]; [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[view]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(@"view", view)]]; [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[view]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(@"view", view)]]; }

Categories : Objective C

Modal View over UINavigationController - visibleViewController unrecognized selector sent to instance
I've found the key point. I had this in my AppDelegate: - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return [[(UINavigationController *)window.rootViewController visibleViewController] supportedInterfaceOrientations]; } And that was the root of all evil. Removed = fixed :) Thanks to all!

Categories : IOS

UINavigationController custom LabelView when pushing a new view Controller onto the stack
That is because you are setting the titleView of the UINavigationController. This will only temporarily change the current title view. To properly change the title view, use the titleView property of the UINavigationItem. The navigation controller framework will take care of setting up the views of the UINavigationController based on the current navigation item for you, and will also make sure animations are smooth.

Categories : IOS

Wired black space under screen when pop to previous view controller using UINavigationController
I add setNavigationBarHidden: method in the back button action method. it works. If i add this method in viewWillDisappear: method or others, it seems it doesn't work. The navigation bar will have effect on next appear view controller. which means, there will be a black space in the next view controller in the navigation stack. Finally, i add a action method for the back button and setNavigationBarHidden:YES in the method, which is as follows: - (void)backBtnClicked:(id)sender { [self.navigationController popViewControllerAnimated:NO]; [self.navigationController setNavigationBarHidden:YES]; }

Categories : IOS

Warning: Attempt to present UINavigationController on ViewController whose view is not in the window hierarchy
All you have to do is move the method to viewDidAppear: -(void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; NSString *user = [prefs stringForKey:@"userName"]; if(user.length>0){ NSLog(@"Going straight to main %s", "Yes"); [self performSegueWithIdentifier:@"startMain" sender:self]; } }

Categories : IOS

UINavigationController.view.frame returns portrait CGRect even in landscape orientation. How to fix this?
in xcode click on the project file.In Summary details you will have orientations with four buttons each specifying a orientation.you can uncheck the unwanted orientation or check only two landscape orientations.you will get it.

Categories : Iphone

UILabel set to center of view
This is caused by your view variable not having a frame defined. By default it has a frame set to (0, 0, 0, 0), so its center is (0, 0). Hence when you do label.center = view.center;, you set the center of your label to (0 - label.width / 2, 0 - label.height /2). (-80.5 -10.5; 161 21) in your case. There is no need for a new UIView if your UIViewController already have one, just work with self.view. - (void)viewDidLoad { [super viewDidLoad]; //create the view and make it gray self.view.backgroundColor = [UIColor darkGrayColor]; //everything for label UILabel *label = [[UILabel alloc] init]; //set text of label // stringWithFormat is useful in this case ;) NSString *welcomeMessage = [NSString stringWithFormat:@"Welcome, %@!", @"username"]; label.tex

Categories : IOS

Updating UILabel in Child View 1 after Global Variable Update in Child View 2
In ButtonViewController, you don't want to be alloc init'ing an instance of LabelViewController -- the one that's on screen already exists. Both child view controllers are instantiated just before the parent controller is. So, what you need to do is get a reference to the LabelViewController that's on screen. You can do that with self.parentViewController.childViewControllers[0] (that 0 might have to be 1 -- I don't know which controller is which). LabelViewController *fnc = self.parentViewController.childViewControllers[0]; [fnc loadLabel];

Categories : IOS

Updating uilabel in view controller underneath another
When you are calling this line from FourthViewController.m you are actually creating a new instance of FirstViewController, rather than using the already created one. UIViewController *firstController = [self.storyboard instantiateViewControllerWithID:@"First"]; You can tackle this in two ways. 1) Using notification post a notification from FourthViewController when label text need to be changed. [[NSNotificationCenter defaultCenter] postNotificationName:@"updateLabel" object:self]; In your FirstViewController viewDidLoad methodcreate an observer that waits for this notification to get fired. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateLabelCalled:) name:@"updateLabel" object:nil];

Categories : IOS

UILabel is not resized in view after calling sizeToFit
This is a problem with the constraints. Thank you! I fixed it by clearing the constraints and added this line: _myLabel.preferredMaxLayoutWidth = [_myLabel alignmentRectForFrame:_myLabel.frame].size.width; to force the label to readjust it's height.

Categories : IOS

Change UILabel insider Header for a collection view
You already have a header view, so dequeuing one creates another one which is not the one you're trying to change. There is no way to access a header view in a collection view -- there's no headerForSection: method, so you have to change the label through your data source. So, if you just have the one header, then you should have a string property, lets call it headerTitle, that you use to populate the label in the header. So, your implementation of collectionView:viewForSupplementaryElementOfKind:atIndexPath: should look something like this: -(UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath { RDReusableHeader *headerView; if (kind == UICollectionElementKindSectionH

Categories : Iphone

UILabel in a grouped table view's header doesn't wrap text
You should implement the delegate method heightForHeaderInSection. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { if(section ==1) return 100; else return 0; }

Categories : Iphone

Warning: Attempt to dismiss from view controller (UINavigationController) while a presentation or dismiss is in progress
This warning can happen if the SecondViewController is dismissed with a call to (void)facebookUpdated:(NSNotification *)notification before the animation to make it appear in the first place has finished. You can: Ignore the warning Avoid it by not animating the display of SecondViewController if it is likely to be dismissed right away. Avoid it while still allowing animation by setting a callback on the initial view controller animation that calls a function on the second view controller telling it that the animation has finished. Then you can check for this property in (void)facebookUpdated:(NSNotification *)notification before calling dismissViewControllerAnimated, and, if the load hasn't finish, set another flag to have the original animation callback function call dismissViewContr

Categories : Objective C

UILabel in nested view in UIScrollView gets compressed under autolayout even with 1000 content compression resistance
I had the same issue. There seems to be a bug with apple, so multiline text requires a two-pass approach to layout correct and it all relies on the property preferredMaxLayoutWidth. I ended up adding these two methods to the ScrollViewController: - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; [self performSelectorOnMainThread:@selector(adjustScrollContentSizeOnMainThread) withObject:nil waitUntilDone:NO]; } - (void)adjustScrollContentSizeOnMainThread { self.myLabel.preferredMaxLayoutWidth = self.myLabel.bounds.size.width; } I based my solution on this answer: http://stackoverflow.com/a/13616052/2828256

Categories : IOS

Is there any way to remove a view (by name) from a Prism region when the view was added using the RegionManager.RequestNavigate method?
It stems from how you add your view, not with your removal. Previously asked answered by adding the view fully, aka including the name. _regionManager.Regions["MyRegion"].Add(myView, "MyView"); So now you can do your retrieval and removal: var theView = _regionManager.Regions["MyRegion"].GetView("MyView"); _regionManager.Regions["MyRegion"].Remove(theView); Without defining name during Regions.Add() In your View, define a property that is accessible (public if multi-project, internal if all in one project). Use this property in everything, one example would be a public string ViewTitle { get { return "XYZ"; } }. Then retrieve from the Views the item that has the desired ViewTitle. The Views collection is the collection of views in that region, so you can use dynamic in .NET 4.0+

Categories : C#

Android App telling me to to remove my child view from parent, I'm not adding it to another view though
Can someone please explain why my code isn't working You create the n and t TextView widgets outside the loop, then repeatedly call addView() to add them to the row inside the loop. Hence, on the second pass of the loop, the children already have a parent (from the addView() calls in the first pass of the loop), and you get your exception. Assuming the loop itself is otherwise correct (and that's more tied to your desired UI and business logic), you need to create fresh TextView widgets on each pass of the loop.

Categories : Android

How can I remove a view I added to navigationcontroller view?
Here crash occurred because of this code: [self.navigationController.view removeFromSuperview]; You are trying to remove the navigationController view not the settings view. When you add the SettingsViewController add a tag to it: -(IBAction)settingsButtonPressed:(id)sender { SettingsViewController *settings = [[SettingsViewController alloc]init]; settings.view.tag = 7; [self.navigationController.view addSubview:settings.view]; } And use this tag to remove the view from the navigationcontroller: -(IBAction)exitSettings:(id)sender { [[self.navigationController.view viewWithTag:7] removeFromSuperview]; }

Categories : IOS

Remove from Observable collection in ViewModel does not update View, but Updates of Existing Items does update View
The code you're pasting should work, from what I can see. The most likely culprit is that your TransactionUpdateReceived event is being raised on a thread that is not the user interface thread. In WPF, single items can be modified on a background thread, but collections cannot (prior to .NET 4.5, but in .NET 4.5, they require extra work). There are two options. If you're using .NET 4.5, you can use BindingOperations.EnableCollectionSynchronization to allow the ObservableCollection to be modified from a background thread. Alternatively, you can use Dispatcher.Invoke to push the Add/Remove calls onto the main thread.

Categories : Dotnet

How to remove split second white screen between dismissing a view controller and loading a new view controller
check out this code:- self.view.backgroundColor = [UIColor clearColor]; self.modalPresentationStyle = UIModalPresentationCurrentContext; [self presentModalViewController:modalVC animated:YES];

Categories : IOS

ios UILabel implement dynamic font size change by UILabel size change
label.font = [UIFont fontWithName:@"Your desired font" size:newSize]; or you could do it even easier: By looking here UILabel - set property adjustsFontSizeToFitWidth to YES

Categories : IOS

How to remove logic from view
Several alternatives. But first: your current implementation is very bad: nobody except your object must check its internals. having several conditionals is not a big deal So in your model, do: def active? subscription_status == 'active' end and replace: <% if @user.subscription_status == 'active' %> with: <% if @user.active? %> If you want to dig deeper, look at decorators, like the draper gem. If you want oneliners, use link_to_if, see here.

Categories : Javascript

how to remove background view
you should disable back button on login view - (void)viewWillAppear:(BOOL)animated { self.navigationItem.leftBarButtonItem=nil; self.navigationItem.hidesBackButton=YES; [super viewWillAppear:animated]; }

Categories : Iphone

How to remove view in Objective C
It seems that you myTableView property returns a different view, not the one that is referenced in the view property. So you basically add the former as a subview ([[self view] addSubview:[addressTableController myTableView]];), but try to remove the latter ([addressTableController.view removeFromSuperview];). Just do [[addressTableController myTableView] removeFromSuperview]; instead of [addressTableController.view removeFromSuperview]; Here you go. Cheers, mate! :) P.S. if you want to animate the view out, you can do it like this [UIView animateWithDuration:1.0 delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{ // animation code... } completion:^(BOOL finished) { [[addressTableController myTableView] removeFromSuperview]; }];

Categories : IOS

Remove img tag from Html.Raw in Razor View
Before you get to the razor you can strip them in the controller with code like this. var news = news.newsText.Substring(0, 400); news = Regex.Replace(news, @"<imgs[^>]*>(?:s*?</img>)?", "", RegexOptions.IgnoreCase); However, I would suggest using something like the Html Agility Pack for tasks such as these.

Categories : Asp Net Mvc

How to remove grid view pagesize?
No, you cannot control the amount of rows to grow or shrink based upon the vertical height of the entire grid. You are better off truncating the values displayed in the grid and then having a view details button in each row or creating a hover effect that displays the full text if the user wishes to view it. Another possibility is to to have a drop down list with page size values (i.e. 5, 10, 20, 25, 50, etc.) that allows the user to adjust the amount of rows displayed on a page to their liking.

Categories : Asp Net

Remove Rails partial from view
Ok quick solution with jquery: _partial.html.erb <div id="unique"> <p>Html code here</p> </div> View.html.erb <%= render :partial => 'partial' %> <script type="text/javascript"> window.onload = function () { $('#unique').remove() } </script> removing the DOM node with jquery .remove() http://api.jquery.com/remove/

Categories : Ruby On Rails

Remove fragments from detail view
You can use FragmentManager.getBackStackEntryCount() to get number of fragments in backstack and use FragmentManager.popBackStack() to pop the top fragment in stack one-by-one.

Categories : Android

Cannot remove UIActivityIndicator and the view that contains it from screen
You may be calling ur method "hideActivityViewer" from asynchronous or thread completion blocks. If so, call ur method on mainthread i.e [self performSelectorOnMainThread:@selector(hideActivityViewer) withObject:nil waitUntilDone:NO];

Categories : IOS

How to remove boilerplate from Razor View
This link gives some insight into creating a base type for a razor view. http://haacked.com/archive/2011/02/21/changing-base-type-of-a-razor-view.aspx

Categories : C#

How to remove id & name attributes from rails view helper
id and name can be removed by assigning nil to it: select_tag nil, "<option>David</option>".html_safe, id: nil # => <select><option>David</option></select>

Categories : HTML



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