Search Results

Search found 447 results on 18 pages for 'uibutton'.

Page 16/18 | < Previous Page | 12 13 14 15 16 17 18  | Next Page >

  • UITableView section header and section footer not updating (redraw problem)

    - by Gerd
    I have a UITableView grouped style with custom header and footer view. Inside the footer I put a UILabel and a UIButton. Clicking on the button hides or show some rows, updates the UILabel in the footer view and finally resizes footer view. Basically everything is working fine. BUT the text ion the label is not updated on the screen. It is updated in the UILabel text property, but only if I scroll the section footer out of the visible area and scroll it back, it is updated. So it's a typical redraw problem here of the UITableView. I tried every method to force update like needsLayout etc. Nothing helped. I have seen some related questions but with some different behaviour and no solution. Any help/ideas? Thanks, Gerd

    Read the article

  • How to load View from NIB into another NIB?

    - by Sheehan Alam
    I have two NIB's ParentViewController.xib ChildViewController.xib ParentViewController.xib contains a UIView and a UIViewController. ChildViewController.xib contains a UIButton I want ChildViewController.xib to load in the ParentViewController.xib's UIView I have done the following: Created @property for UIView in ParentViewController Connected File's Owner to UIView in ParentViewController Set UIViewController in ParentViewController's NIB Name property to ChildViewController in Interface Builder Set ChildViewController view property to UIView in ParentViewController I was hoping this would load ChildViewController into my UIView in ParentViewController but no luck. I did get the following warning, which could be the culprit: 'View Controller (Child View)' has both its 'NIB Name' property set and its 'view' outlet connected. This configuration is not supported. I also have added additional code in ParentViewController's viewDidLoad(): - (void)viewDidLoad { [super viewDidLoad]; ChildViewController *childViewController = [[ChildViewController alloc]initWithNibName:@"ChildViewController" bundle:nil]; childViewController.view = self.myView; } Any thoughts on why ChildViewController does not load in the UIView of ParentViewController?

    Read the article

  • iPhone modalView unwanted offset

    - by Chonch
    Hey, I have a UITabBarController with three view controllers (from three different types). On one of the view controllers, I want to display a modalViewController. Once a UIButton on the screen is pressed, I perform this action: AboutViewController *modalViewController = [[AboutViewController alloc] initWithNibName:@"AboutScreen" bundle:nil]; [self presentModalViewController:modalViewController animated:YES]; like I always do in order to display a modal view... The problem is, that while the modal view is being displayed (while it is moving from the bottom of the screen), a 20 pixels grey strip is showing on the bottom of the screen (the same size as the status bar on the top). Once the modal view reaches its final location, the strip disappears. Needless to say this doesn't look good (to say the least). Does anybody know why this may happen? Thanks,

    Read the article

  • How to overlay view over navigation controller bar?

    - by 0SX
    I've sorta got a little problem. I'm trying to add a popoverview to my app but part of the popoverview get's hidden by my navigation controller bar. How can I make my popoverview overlay over top of the navcontrollerbar? Here's an image of the problem: http://img593.imageshack.us/img593/4056/viewn.jpg Here's my code I'm working with: - (IBAction)onButtonClick:(UIButton *)button { if (self.popoverController) { [self.popoverController dismissPopoverAnimated:YES]; self.popoverController = nil; [button setTitle:@"Show Popover" forState:UIControlStateNormal]; } else { UIViewController *contentViewController = [[WEPopoverContentViewController alloc] initWithStyle:UITableViewStylePlain]; self.popoverController = [[[WEPopoverController alloc] initWithContentViewController:contentViewController] autorelease]; [self.popoverController presentPopoverFromRect:button.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES]; [contentViewController release]; [button setTitle:@"Hide Popover" forState:UIControlStateNormal]; } } Is there anyway to make this popover above the navigation controller bar? Here is the full source code what I'm working with https://github.com/werner77/WEPopover Hopefully someone knows how to fix this problem, Thanks in advance.

    Read the article

  • iphone - forcing button to acknowledge touch programmatically

    - by Mike
    When you touch a UIButton it hides for a fraction of second and then it executes its action. This fast "blink" is the feedback the user needs to know that the button has been clicked. In the project I am doing, I need to select the button programmatically, as if the user had clicked it. In other words, the same behavior has the button had been clicked by the user... a fast blink and execution of its action. Is this possible? thanks for any help.

    Read the article

  • Adding view to UIScrollView and toggling scrolling/interacting

    - by Peter Hajas
    Hi all! I have a UIScrollView in my project. I have a view controller I would like to add as a child of the UIScrollview. Would I just do that like this: [scrollView addSubview:theViewController.view]; or is there a better way? (theView is a view, not the TV show) Furthermore, I would like to be able to use a UIButton in scrollView's parent view controller to toggle whether or not the user is scrolling with scrollView and NOT interacting with theView or NOT scrolling with scrollview and interacting with theView. Should I just have that set the property: scrollView.userInteractionEnabled = NO; or would that disable interaction with theView because it's a child? Thanks for your help!

    Read the article

  • Unable to load detached NIB in View

    - by Sheehan Alam
    I have two NIB's ParentViewController.xib ChildViewController.xib ParentViewController.xib contains a UIView and a UIViewController. ChildViewController.xib contains a UIButton I want ChildViewController.xib to load in the ParentViewController.xib's UIView I have done the following: Created @property for UIView in ParentViewController Connected File's Owner to UIView in ParentViewController Set UIViewController in ParentViewController's NIB Name property to ChildViewController in Interface Builder Set ChildViewController view property to UIView in ParentViewController I was hoping this would load ChildViewController into my UIView in ParentViewController but no luck. I did get the following warning, which could be the culprit: 'View Controller (Child View)' has both its 'NIB Name' property set and its 'view' outlet connected. This configuration is not supported. I also have added additional code in ParentViewController's viewDidLoad(): - (void)viewDidLoad { [super viewDidLoad]; ChildViewController *childViewController = [[ChildViewController alloc]initWithNibName:@"ChildViewController" bundle:nil]; childViewController.view = self.myView; } Any thoughts on why ChildViewController does not load in the UIView of ParentViewController?

    Read the article

  • CATransitionFade not working on newly added subviews

    - by David Liu
    For some reason, fading in new buttons using CATransition isn't working for me when it's a newly added button. The fade animation, however, is working on existing subviews. Code: // Add new button. CATransition *animation = [CATransition animation]; [animation setDuration:0.5]; [animation setType:kCATransitionFade]; [[button layer] addAnimation:animation forKey:@"fadeIn"]; [self.view addSubview:button]; // Enable previous button (Enabling fades in different type of background) if(toolbar.buttons.count != 0){ UIButton * prevButton = [toolbar.buttons objectAtIndex:(toolbar.buttons.count - 1)]; prevButton.enabled = YES; [[prevButton layer] addAnimation:animation forKey:@"fadeIn"]; }

    Read the article

  • Newbie: UINavigationController is pulling me back from further learning :(

    - by nithin
    I have created a window-based application and my problem is I am unable to create UINavigationController on the go. InFact I don't know how to do that. My AppDelegeate - (void)applicationDidFinishLaunching:(UIApplication *)application { // Override point for customization after application launch [window addSubview:logInView.view]; [window makeKeyAndVisible]; } here the logInView is an object of @interface LogInViewController : UIViewController { IBOutlet UITextField *usernameField; IBOutlet UITextField *passwordField; IBOutlet UIButton *logInButton; } -(IBAction) logInClick:(id) sender; from the click action of this loginviewcontroller It should be showing the home screen with navigation controller. and I have to add many subviews. My question is where should I init the UINavigationController and where could I write the codes for adding subviews? how to map it with interfacebuilder?

    Read the article

  • How to Make URLs clickable inside of UITableViewCell ?

    - by Chris
    I know how to use UIWebView and can invoke a WebView if it is associated with a specific button or UITableViewCell. What I am trying to achieve is to have a UITableViewCell with a chunk of text. That chunk of text might contain a URL. I want to make the URL into a clickable link and have that link open into a WebView. My thought so far has been that I need to detect a link and insert it as a UIButton within the cell... but I don't know if that is the right way to go about this. Any ideas or input would be much appreciated.

    Read the article

  • Views jump during ViewDidLoad

    - by Jon-Paul
    Hi, I have a custom button, subclassed from UIButton that is initialised as below (obviously all the button does is use a custom font). @implementation HWButton - (id)initWithCoder:(NSCoder *)decoder { if (self = [super initWithCoder: decoder]) { [self.titleLabel setFont:[UIFont fontWithName: @"eraserdust" size: self.titleLabel.font.pointSize]]; } return self; } So far so good. But when I use the custom class in my nib and launch the app, the button initially displays for a split second as tiny with small text, then grows. So the outcome is what I want, but I don't want to see the transition. Can anyone put me right? Thanks. JP

    Read the article

  • Sorting Table Cells based on data from NSArray

    - by Graeme
    Hi, I have an NSArray which contains information from an RSS feed on dogs, such as [dog types], [dog age] and [dog size]. At the moment my UITableView simply displays each cell on each dog and within the cell lists [dog types], [dog age] and [dog size]. I want to be able to allow users of my app to "sort" this data based on the dog name, dog size or dog age when they press a UIButton in the top nav-bar. I'm struggling to work out how to filter the UITableView based on these factors, so any help is appreciated. Thanks.

    Read the article

  • iPhone Map: Identifying Users Location

    - by senfo
    I have a number of annotations on my map, in addition to the users current location. This works fine, except the default color for the users current location is the same as all of the other annotations. I'd like to make the pin green for the users current location so that it's uniquely identifiable from the other pins. How do I do this? Bellow is the method I've been using (I can't find a way to determine which annotation is the users current location): - (MKAnnotationView *)mapView:(MKMapView *)mapViewLocal viewForAnnotation:(id <MKAnnotation>)annotation { static NSString *identifier = @"Pin"; MKPinAnnotationView *pinView = (MKPinAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:identifier]; if (pinView == nil) { pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier] autorelease]; pinView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; pinView.animatesDrop = YES; pinView.canShowCallout = YES; } else { pinView.annotation = annotation; } return pinView; }

    Read the article

  • iPhone - dealloc subview UIViewController when removeFromSuperview

    - by bbullis21
    I have several buttons on my main UIViewController (main menu) that creates and adds a subview UIViewController on top of the main menu. When I remove the subview the memory from that controller is not released. How can I release that subviews memory instantly? Does anyone have an example? This would solve all my problems! Thanks in advance. Here is how I add a subview if((UIButton *) sender == gameClassicBtn) { GameClassic *gameClassicController = [[GameClassic alloc] initWithNibName:@"GameClassic" bundle:nil]; self.gameClassic = gameClassicController; [gameClassicController release]; [self.view insertSubview:gameClassicController.view atIndex:1]; }

    Read the article

  • My map callouts don't display the image when clicked

    - by Neelam Khan
    I am developing an iPhone application for a university project and I'm new to iPhone development. I have looked through Apple's MapCallouts code but it doesn't seem feasible to implement it. So far my code displays a map, drops annotations, displays the title and it displays the right call out button. But this is where I encounter problems. When I press on the callout button, it displays a blank view controller but it should display a different image for every callout that's tapped and this isn't happening so far. I have added my code below: - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { //NSUInteger tag = ((UIButton *)control).tag; if (self.detailController==nil) { DetailViewController* detailViewController = [[DetailViewController alloc] init]; [self.navigationController pushViewController:detailViewController animated:YES]; } // self.detailController.tag =1; //to identify image required // self.detailController.tag = tag; [self.navigationController pushViewController:detailController animated:YES]; }

    Read the article

  • Losing NSManaged Objects in my Application

    - by Wayfarer
    I've been doing quite a bit of work on a fun little iPhone app. At one point, I get a bunch of player objects from my Persistant store, and then display them on the screen. I also have the options of adding new player objects (their just custom UIButtons) and removing selected players. However, I believe I'm running into some memory management issues, in that somehow the app is not saving which "players" are being displayed. Example: I have 4 players shown, I select them all and then delete them all. They all disappear. But if I exit and then reopen the application, they all are there again. As though they had never left. So somewhere in my code, they are not "really" getting removed. MagicApp201AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; context = [appDelegate managedObjectContext]; NSFetchRequest *request = [[NSFetchRequest alloc] init]; NSEntityDescription *desc = [NSEntityDescription entityForName:@"Player" inManagedObjectContext:context]; [request setEntity:desc]; NSError *error; NSMutableArray *objects = [[[context executeFetchRequest:request error:&error] mutableCopy] autorelease]; if (objects == nil) { NSLog(@"Shit man, there was an error taking out the single player object when the view did load. ", error); } int j = 0; while (j < [objects count]) { if ([[[objects objectAtIndex:j] valueForKey:@"currentMultiPlayer"] boolValue] == NO) { [objects removeObjectAtIndex:j]; j--; } else { j++; } } [self setPlayers:objects]; //This is a must, it NEEDS to work Objects are all the players playing So in this snippit (in the viewdidLoad method), I grab the players out of the persistant store, and then remove the objects I don't want (those whose boolValue is NO), and the rest are kept. This works, I'm pretty sure. I think the issue is where I remove the players. Here is that code: NSLog(@"Remove players"); /** For each selected player: Unselect them (remove them from SelectedPlayers) Remove the button from the view Remove the button object from the array Remove the player from Players */ NSLog(@"Debugging Removal: %d", [selectedPlayers count]); for (int i=0; i < [selectedPlayers count]; i++) { NSManagedObject *rPlayer = [selectedPlayers objectAtIndex:i]; [rPlayer setValue:[NSNumber numberWithBool:NO] forKey:@"currentMultiPlayer"]; int index = [players indexOfObjectIdenticalTo:rPlayer]; //this is the index we need for (int j = (index + 1); j < [players count]; j++) { UIButton *tempButton = [playerButtons objectAtIndex:j]; tempButton.tag--; } NSError *error; if ([context hasChanges] && ![context save:&error]) { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } UIButton *aButton = [playerButtons objectAtIndex:index]; [players removeObjectAtIndex:index]; [aButton removeFromSuperview]; [playerButtons removeObjectAtIndex:index]; } [selectedPlayers removeAllObjects]; NSError *error; if ([context hasChanges] && ![context save:&error]) { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } NSLog(@"About to refresh YES"); [self refreshAllPlayers:YES]; The big part in the second code snippet is I set them to NO for currentMultiPlayer. NO NO NO NO NO, they should NOT come back when the view does load, NEVER ever ever. Not until I say so. No other relevant part of the code sets that to YES. Which makes me think... perhaps they aren't being saved. Perhaps that doesn't save, perhaps those objects aren't being managed anymore, and so they don't get saved in. Is there a lifetime (metaphorically) of NSManaged object? The Players array is the same I set in the "viewDidLoad" method, and SelectedPlayers holds players that are selected, references to NSManagedObjects. Does it have something to do with Removing them from the array? I'm so confused, some insight would be greatly appreciated!!

    Read the article

  • Are the built-in images in iPhone documented, and is there a list of their names somewhere?

    - by Alex Gosselin
    I discovered somewhat by accident that if you make a UIButton in Interface Builder and type in Plus in the image field, a + image appears for the button. A similar result comes from typing Minus. I am wondering if this is a bug, or if there is some way the poor programmers can access the built-in general GUI images from other apple apps, such as the green +, the red -, the detail disclosure chevron, the big red "Delete Contact" or similarly styled button, etc. Has anyone else encountered this, or know where to access these things in Xcode? It makes sense to me that they should be usable, cause the Apple HIG seems to be all about making things recognizable and intuitive, and using them the way other apps use them.

    Read the article

  • How to load a NIB inside of a view in another NIB?

    - by Sheehan Alam
    I have two NIB's ParentViewController.xib ChildViewController.xib ParentViewController.xib contains a UIView and a UIViewController. ChildViewController.xib contains a UIButton I want ChildViewController.xib to load in the ParentViewController.xib's UIView I have done the following: Created @property for UIView in ParentViewController Connected File's Owner to UIView in ParentViewController Set UIViewController in ParentViewController's NIB Name property to ChildViewController in Interface Builder Set ChildViewController view property to UIView in ParentViewController I was hoping this would load ChildViewController into my UIView in ParentViewController but no luck. I did get the following warning, which could be the culprit: 'View Controller (Child View)' has both its 'NIB Name' property set and its 'view' outlet connected. This configuration is not supported. I also have added additional code in ParentViewController's viewDidLoad(): - (void)viewDidLoad { [super viewDidLoad]; ChildViewController *childViewController = [[ChildViewController alloc]initWithNibName:@"ChildViewController" bundle:nil]; childViewController.view = self.myView; } Any thoughts on why ChildViewController does not load in the UIView of ParentViewController?

    Read the article

  • Optimizing an iphone app for 3G in landscape with opengl, camera, quartz

    - by Joey
    I have an iphone app that basically uses the camera, an opengl layer, and UIViews (some drawing with Quartz). It runs ok on 3GS, but on the 3G it is unusable. Particularly, when I press a UIButton, it literally takes sometimes 10 seconds to register the press. Shark doesn't do me much good because it crashes when I try to profile even a tiny portion, and I've tried turning off some of the layers to see if they might be obvious contributors to the lag. I've noticed that turning off the camera really helps. I'm wondering if anyone has any familiarity with this and might suggest some likely causes. I had issues with extreme slowdown from running my app in landscape mode and using transforms, so considered that might be a cause, but I'm wondering if hoping for a 3G to run something with all of the above elements is just not really possible considering the camera seems to really cost a lot. The fact that the buttons are horribly delayed in their response makes me think there is something fundamental that I might be missing.

    Read the article

  • iPhone Input with Stacked Views

    - by Forrest
    Hi, I've got a situation in an iphone application where buttons are not receiving input as I expect. Here's the setup: ViewMain - The main view full of various images and labels ViewOverlay - A HUD like overlay view with two UIButton objects. To create my scene I do the following: viewController.view = ViewMain [ViewMain addsubview:ViewOverlay] This view renders as expected, with ViewOverlay correctly rendered ontop of ViewMain. However the two buttons found inside ViewOverlay do not receive touch events and can not be pressed. Tapping them does nothing at all. I very well may be going about this in the entirely wrong direction. Any ideas?

    Read the article

  • How do I change the UIView programmatically?

    - by user317834
    I have created View A and View B. My window has View A displayed on the screen. I also have a UIButton on View A. I want to switch from View A to View B when I click on the Button. I am not using any UIViewController. Is it possible to switch the views without using controller? I am calling buttonAction method on TOUCHUPINSIDE The problem is that it doesn't do anything when I say [ViewA removeFromSuperView]; What should I do now?

    Read the article

  • UI View Controller crashes after interruption

    - by nosuic
    Given the multitasking of iOS I thought it wouldn't be a pain to pause and resume my app, by pressing the home button or due to a phone call, but for a particular view controller it crashes. The navigation bar is working fine i.e. when I tap "Back" it's ok, but if I try to tap controls of the displayed UI View Controller then I get EXC_BAD_ACCESS.. =/ Please find the code of my problematic View Controller below. I'm not very sure about it myself, because I used loadView to build its View, but apart from this interruption problem it works fine. StoreViewController.h #import <UIKit/UIKit.h> @protocol StoreViewDelegate <NSObject> @optional - (void)DirectionsClicked:(double)lat:(double)lon; @end @interface StoreViewController : UIViewController { double latitude; double longitude; NSString *description; NSString *imageURL; short rating; NSString *storeType; NSString *offerType; UIImageView *imageView; UILabel *descriptionLabel; id<StoreViewDelegate> storeViewDel; } @property (nonatomic) double latitude; @property (nonatomic) double longitude; @property (nonatomic) short rating; @property (nonatomic,retain) NSString *description; @property (nonatomic,retain) NSString *imageURL; @property (nonatomic,retain) NSString *storeType; @property (nonatomic,retain) NSString *offerType; @property (assign) id<StoreViewDelegate> storeViewDel; @end StoreViewController.m #import "StoreViewController.h" #import <QuartzCore/QuartzCore.h> @interface StoreViewController() -(CGSize) calcLabelSize:(NSString *)string withFont:(UIFont *)font maxSize:(CGSize)maxSize; @end @implementation StoreViewController @synthesize storeViewDel, longitude, latitude, description, imageURL, rating, offerType, storeType; - (void)mapsButtonClicked:(id)sender { } - (void)loadView { UIView *storeView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 0.0f, 0.0f)]; // Colours UIColor *lightBlue = [[UIColor alloc] initWithRed:(189.0f / 255.0f) green:(230.0f / 255.0f) blue:(252.0f / 255.0f) alpha:1.0f]; UIColor *darkBlue = [[UIColor alloc] initWithRed:(28.0f/255.0f) green:(157.0f/255.0f) blue:(215.0f/255.0f) alpha:1.0f]; // Layout int width = self.navigationController.view.frame.size.width; int height = self.navigationController.view.frame.size.height; float firstRowHeight = 100.0f; int margin = width / 20; int imgWidth = (width - 3 * margin) / 2; // Set ImageView imageView = [[UIImageView alloc] initWithFrame:CGRectMake(margin, margin, imgWidth, imgWidth)]; CALayer *imgLayer = [imageView layer]; [imgLayer setMasksToBounds:YES]; [imgLayer setCornerRadius:10.0f]; [imgLayer setBorderWidth:4.0f]; [imgLayer setBorderColor:[lightBlue CGColor]]; // Load default image NSData *imageData = [NSData dataWithContentsOfFile:@"thumb-null.png"]; UIImage *image = [UIImage imageWithData:imageData]; [imageView setImage:image]; [storeView addSubview:imageView]; // Set Rating UIImageView *ratingView = [[UIImageView alloc] initWithFrame:CGRectMake(3 * width / 4 - 59.0f, margin, 118.0f, 36.0f)]; UIImage *ratingImage = [UIImage imageNamed:@"bb-rating-0.png"]; [ratingView setImage:ratingImage]; [ratingImage release]; [storeView addSubview:ratingView]; // Set Get Directions button UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(3 * width / 4 - 71.5f, 36.0f + 2*margin, 143.0f, 63.0f)]; [btn addTarget:self action:@selector(mapsButtonClicked:) forControlEvents:UIControlEventTouchUpInside]; UIImage *mapsImgUp = [UIImage imageNamed:@"bb-maps-up.png"]; [btn setImage:mapsImgUp forState:UIControlStateNormal]; [mapsImgUp release]; UIImage *mapsImgDown = [UIImage imageNamed:@"bb-maps-down.png"]; [btn setImage:mapsImgDown forState:UIControlStateHighlighted]; [mapsImgDown release]; [storeView addSubview:btn]; [btn release]; // Set Description Text UIScrollView *descriptionView = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0f, imgWidth + 2 * margin, width, height - firstRowHeight)]; descriptionView.backgroundColor = lightBlue; CGSize s = [self calcLabelSize:description withFont:[UIFont systemFontOfSize:18.0f] maxSize:CGSizeMake(width, 9999.0f)]; descriptionLabel = [[UILabel alloc] initWithFrame:CGRectMake(margin, margin, width - 2 * margin, s.height)]; descriptionLabel.lineBreakMode = UILineBreakModeWordWrap; descriptionLabel.numberOfLines = 0; descriptionLabel.font = [UIFont systemFontOfSize:18.0f]; descriptionLabel.textColor = darkBlue; descriptionLabel.text = description; descriptionLabel.backgroundColor = lightBlue; [descriptionView addSubview:descriptionLabel]; [storeView addSubview:descriptionView]; [descriptionLabel release]; [lightBlue release]; [darkBlue release]; self.view = storeView; [storeView release]; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc. that aren't in use. } - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [imageView release]; [descriptionLabel release]; [super dealloc]; } @end Any suggestions ? Thank you, F.

    Read the article

  • Press a Button and open a URL in another ViewController

    - by Dennis Borup Jakobsen
    I am trying to learn Xcode by making a simple app. But I been looking on the net for hours (days) and I cant figure it out how I make a button that open a UIWebView in another ViewController :S first let me show you some code that I have ready: I have a few Buttons om my main Storyboard that each are title some country codes like UK, CA and DK. When I press one of those Buttons I have an IBAction like this: - (IBAction)ButtonPressed:(UIButton *)sender { // Google button pressed NSURL* allURLS; if([sender.titleLabel.text isEqualToString:@"DK"]) { // Create URL obj allURLS = [NSURL URLWithString:@"http://google.dk"]; }else if([sender.titleLabel.text isEqualToString:@"US"]) { allURLS = [NSURL URLWithString:@"http://google.com"]; }else if([sender.titleLabel.text isEqualToString:@"CA"]) { allURLS = [NSURL URLWithString:@"http://google.ca"]; } NSURLRequest* req = [NSURLRequest requestWithURL:allURLS]; [myWebView loadRequest:req]; } How do I make this open UIWebview on my other Viewcontroller named myWebView? please help a lost man :D

    Read the article

  • Testing if a UI element is hidden in an OCUnit test

    - by Logan Serman
    I have a button that is hidden under certain circumstances that I wish to test. The button is hidden with [theButton setHidden: YES] in the viewDidLoad method if it is appropriate. For simplicity, lets say that the button is hidden when the buttonIsHidden property is set to true in the view controller. Right now I am trying the following: self.viewController = [[ViewController alloc] init]; self.viewController.buttonIsHidden = YES; [self.viewController loadView]; UIButton *theButton = [...] // function I wrote to retrieve the button based on it's touch up inside action if (theButton) { NSLog(@"%c", theButton.hidden); return (theButton.hidden == true) } return NO; It looks like the hidden property is not what it should be, the NSLog lines from the above code are blank. But, if I output another property like the height, it outputs the correct value so I know it is getting the right button. How do I access the hidden property of the button in this case?

    Read the article

  • NSDateFormatter iOS6 issue

    - by Angad Manchanda
    I have written a code for UIButton press to decrement date. The present date is shown in a UILabel text property and it changes to the previous date when the button is pressed. The following code works perfectly fine for iOS5 but doesn't work with iOS6. With iOS6, it gives the output as Dec 31, 1999 or null. - (IBAction)showPrevDate:(id)sender { NSString *dateForDecrement = _showDateLbl.text; [dateFormatter setDateFormat:@"MMM d, yyyy (EEE)"]; NSDate *dateObjectForDecrement = [dateFormatter dateFromString:dateForDecrement]; int subtractDays = 1; dateAfterDecrement=[dateObjectForDecrement dateByAddingTimeInterval:-(24*60*60 * subtractDays)]; _showDateLbl.text = [NSString stringWithFormat:@"%@", [dateFormatter stringFromDate:dateAfterDecrement]]; } Can anybody verify this, or tell me if its's a bug in iOS6 ? Thanks guys.

    Read the article

< Previous Page | 12 13 14 15 16 17 18  | Next Page >