Search Results

Search found 369 results on 15 pages for 'subview'.

Page 14/15 | < Previous Page | 10 11 12 13 14 15  | Next Page >

  • Keyboard blocking my view

    - by John Smith
    I have a UIView with another UIView inside it. On the inside UIView there is a textbox which I want to fill in. When I try to fill it in the keyboard blocks my view: The UIViewController has the following containerView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds]; self.view=containerView; //The apropriate releases etc are further on... When I touch it, the keyboard comes up as expected, but blocks the textbox I'm trying to fill in. How can I force the view to slide up? The front view OptionsFront * fv = [[OptionsFront alloc] initWithFrame:[UIScreen mainScreen].bounds]; [containerView addSubview:frontView]; In the front view is a subview CGRect bounds = CGRectMake(0.0f, 210.0f, 280.0f, 130.0f); sv = [[UIView alloc] initWithFrame:bounds]; [self addSubview:sv]; //added to frontView In sv is a textbox near the botton: rect = CGRectMake(70.0f, 20.0f, 100.0f, 27.0f); cf = [self createTextField_Rounded:rect holder:@"+ve"]; [sv addSubview:cf]; So cf happens to be near the bottom of the page. I expected that when I select it, the whole display would move up, but the keyboard just moves up and blocks it. What can I do? Appendix: - (UITextField *)createTextField_Rounded:(CGRect) frame holder:(NSString *) ph { UITextField *returnTextField = [[UITextField alloc] initWithFrame:frame]; returnTextField.borderStyle = UITextBorderStyleRoundedRect; returnTextField.textColor = [UIColor blackColor]; returnTextField.font = [UIFont systemFontOfSize:17.0]; returnTextField.delegate = self; returnTextField.keyboardType = UIKeyboardTypeNumbersAndPunctuation; returnTextField.returnKeyType = UIReturnKeyDone; returnTextField.clearButtonMode = UITextFieldViewModeWhileEditing; return returnTextField; }

    Read the article

  • MKMapKit exception when using canShowCallout on annotation view

    - by Kendall Helmstetter Gelner
    I'm trying to use a pretty straightforward custom map annotation view and callout - the annotation view when I create it, just adds a UIImageView as a subview to itself. That works fine. However, when I call canShowCallout on the annotation view, An exception is thrown in MapKit immediately after returning the view. The end of the stack looks like: #0 0x94e964e6 in objc_exception_throw #1 0x01e26404 in -[MKOverlayView _addViewForAnnotation:] #2 0x01e22037 in -[MKOverlayView _addViewsForAnnotations:animated:] #3 0x01e1ddf9 in -[MKOverlayView showAddedAnnotationsAnimated:] #4 0x01df9c0e in -[MKMapView _showAddedAnnotationsAndRouteAnimated:] #5 0x01e0371a in -[MKMapView levelView:didLoadTile:] My viewForAnnotation is pretty simple: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { if ( ! [annotation isKindOfClass:[MyAnnotation class]] ) return nil; MyAnnotationView *useView = (MyAnnotationView *)[myMapView dequeueReusableAnnotationViewWithIdentifier:@"resuseview"]; if ( useView == nil ) { useView = [[[MyAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"resuseview"] autorelease]; useView.canShowCallout = YES; // if commented out view appears just fine } else { useView.annotation = annotation; } return useView; } As noted in the code, the annotation view works fine as is - until I add canShowCallout, then it crashes the first time the map gets the view.

    Read the article

  • uiview's controls unresponsive.. or how to foul up a view hierarchy

    - by user293139
    Hello all, I'm working on an app that has two sections, a config section and a results section. My config section needs to be 2 separate views (horizontal and vert, and yes, I can hear the intake of breath from here), with one rotatable view for the results. b/c of layout restraints and a lot of pain around rotation, I'm not using a navigation controller. I've been experiencing the joys of rotation experimentation and have settled upon keeping my views contained as subviews of my view controller. i.e. view controller.view.subviews = configH, configV, and results. I then use the controller.view bringSubviewToFront to bring the either the configH, configV, or the result view to the front. Rotation works-queue(humor intended) the angelic choirs... almost. What's happening is that my configV button's are responsive, but when the device (or simulator) is rotated, my configH controls are not. (configV is the second subview added, but the first one to be brought to the front because app comes up in portrait mode) The controls on the results view also work. Plan B was to assign the controller.view to configH, configV, or results. All of my controls now work, but rotation is now fouled up. Question 1: Is there a better way to do this? (a horizontal and vertical config view and a rotatable results view) Question 2: Does the above suggest a design issue, or is it more likely that my addled brain is just missing something in my own code. (nothing from the peanut gallery please) many thanks!

    Read the article

  • How to disable other touch gestures after adding another tap gesture to the view?

    - by Hudson Duan
    I have a view with some tables and buttons on it, and then I want to add a tap gesture to the entire view, but I only want that gesture recognizer to recognize taps. Ideally, I want to do something when the added gesture recognizer is tapped, then remove that gesture recognizer after so the other buttons and tables can be accessed. Basically a tap to dismiss functionality that replicates something like the facebook notifications window, tap outside to dismiss, but not interfere with the buttons outside of the notifications view. Can anybody help? My current code is: NotificationsWindow *customView = [[[NSBundle mainBundle]loadNibNamed:@"NotificationsWindow" owner:self options:nil]objectAtIndex:0]; customView.frame= CGRectMake(12, 12, customView.frame.size.width, customView.frame.size.height); UITapGestureRecognizer *recognizerForSubView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapBehindAgain:)]; [recognizerForSubView setNumberOfTapsRequired:1]; recognizerForSubView.cancelsTouchesInView = NO; //So the user can still interact with controls in the modal view [customView addGestureRecognizer:recognizerForSubView]; [self.view addSubview:customView]; UITapGestureRecognizer *recognizerForSuperView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapBehind:)]; [recognizerForSuperView setNumberOfTapsRequired:1]; recognizerForSuperView.cancelsTouchesInView = NO; //So the user can still interact with controls in the modal view [customView.superview addGestureRecognizer:recognizerForSuperView]; (void)handleTapBehind:(UITapGestureRecognizer *)sender { NSLog(@"tapped"); [[self.view.subviews lastObject] removeFromSuperview]; [self.view removeGestureRecognizer:sender]; } I want to make it so that the recognizer for the super view dismisses the subview, but not to interfere with the other taps on the super view.

    Read the article

  • Cocoa Touch: Creating and Adding Custom View

    - by Jason
    I create a custom view in cocoa touch that is superclassed by UIView and in my main controller I initialize it and then add it as a subview to the main view, but when I add it to the main view it calls my initializer method again and causes an infinite loop. Am I going about creating my custom view wrong? Here is the mainView (void)loadView { UIImage *tempImage = [UIImage imageNamed: @"image1.jpg"]; CustomImageContainer *testImage = [[CustomImageContainer alloc] initWithImage: tempImage andLabel: @"test image" onTop: true atX: 10 atY: 10]; [self.view addSubview: testImage]; } and the CustomImageContainer -(CustomImageContainer *) initWithImage: (UIImage *)imageToAdd andLabel: (NSString *)text onTop: (BOOL) top atX: (int) x_cord atY: (int) y_cord{ UIImageView *imageview_to_add = [[UIImageView alloc] initWithImage: imageToAdd]; imageview_to_add.frame = CGRectMake(0, 0, imageToAdd.size.width, imageToAdd.size.height); UILabel *label_to_add = [[UILabel alloc] init]; label_to_add.text = text; label_to_add.alpha = 50; label_to_add.backgroundColor = [UIColor blackColor]; label_to_add.textColor = [UIColor whiteColor]; [self addSubview: imageview_to_add]; self.frame = CGRectMake(x_cord, y_cord, imageToAdd.size.width, imageToAdd.size.height); if (top) { label_to_add.frame = CGRectMake(0, 0, imageview_to_add.frame.size.width, imageview_to_add.frame.size.height); //[self addSubview: label_to_add]; } else { label_to_add.frame = CGRectMake(0,.2 * imageview_to_add.frame.size.height, imageview_to_add.frame.size.width, imageview_to_add.frame.size.height); } [self addSubview: label_to_add]; [super init]; return self; }

    Read the article

  • How to call a function from another class file

    - by Guy Parker
    I am very familiar with writing VB based applications but am new to Xcode (and Objective C). I have gone through numerous tutorials on the web and understand the basics and how to interact with Interface Builder etc. However, I am really struggling with some basic concepts of the C language and would be grateful for any help you can offer. Heres my problem… I have a simple iphone app which has a view controller (FirstViewController) and a subview (SecondViewController) with associated header and class files. In the FirstViewController.m have a function defined @implementation FirstViewController (void) writeToServer:(const uint8_t ) buf { [oStream write:buf maxLength:strlen((char)buf)]; } It doesn't really matter what the function is. I want to use this function in my SecondViewController, so in SecondViewController.m I import FirstViewController.h import "SecondViewController.h" import "FirstViewController.h" @implementation SecondViewController -(IBAction) SetButton: (id) sender { NSString *s = [@"Fill:" stringByAppendingString: FillLevelValue.text]; NSString *strToSend = [s stringByAppendingString: @":"]; const uint8_t *str = (uint8_t *) [strToSend cStringUsingEncoding:NSASCIIStringEncoding]; FillLevelValue.text = strToSend; [FirstViewController writeToServer:str]; } This last line is where my problem is. XCode tells me that FirstViewController may not respond to writeToServer. And when I try to run the application it crashes when this function is called. I guess I don't fully understand how to share functions and more importantly, the relationship between classes. In an ideal world I would create a global class to place my functions in and call them as required. Any advice gratefully received.

    Read the article

  • UIButton only responds in a small area

    - by Tom Irving
    I'm trying to add a UIButton to a UIView, but am having some trouble with getting it to respond to touches. I have a method which returns UIButtons after I provide it with a tag: - (UIButton*)niceSizeButtonWithTag:(int)tag { UIButton * aButton = [UIButton buttonWithType:UIButtonTypeCustom]; [aButton setTag:tag]; [aButton addTarget:self action:@selector(buttonWasTapped:) forControlEvents:UIControlEventTouchUpInside]; CGRect newFrame = aButton.frame; newFrame.size.width = 44; newFrame.size.height = 44; [aButton setFrame:newFrame]; return aButton; } As you can see I'm creating a new button and increasing the size. I use this in the following way: UIButton * anotherButton = [self niceSizeButtonWithTag:1]; [anotherButton setImage:[UIImage imageNamed:@"image" withExtension:@"png"] forState:UIControlStateNormal]; [anotherButton setCenter:CGPointMake(middleOfView)]; [aView addSubview:anotherButton]; I create a lot of buttons like this, hence the reason for the method. The buttons are always created and added to the subview perfectly. I can see the image and they're in the correct position. The problem is that they only respond to touches in a tiny strip. In this attached image, The yellow shows the whole frame of the button, The red shows the area that will respond to touches. The grey shows a section of the view the button is added to. If anyone could shed some light on why this is happening, it would be really useful.

    Read the article

  • iOS - Rotating view reveals background.

    - by Jack
    Hi, I have created a view that I want to be able to rotate. The two views are: containerView and this has a .backgroundColor of red and BackgroundImage as a subview. Here is my code for rotating: - (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { [self adjustViewsForOrientation:toInterfaceOrientation]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } - (void) adjustViewsForOrientation:(UIInterfaceOrientation)orientation { if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) { backgroundImage.image = [UIImage imageNamed:@"landscape.jpg"]; backgroundImage.frame = CGRectMake(0, 0, 1024, 704); containerView.frame = CGRectMake(0, 0, 1024, 704); self.title = @"landscape"; } else if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) { backgroundImage.image = [UIImage imageNamed:@"portrait.jpg"]; backgroundImage.frame = CGRectMake(0, 0, 768, 960); containerView.frame = CGRectMake(0, 0, 768, 960); self.title = @"portrait"; } } The problem is that the image rotates, but the background color is shown whilst the view rotates. Is there a nice solution to this problem (I know that I could create the images to blend into a color and set the background to the same color, but this is not what I would like). A Video of the problem can be seen here:http://tinypic.com/r/2quj24g/6 PS the images are from the OmniGroup GitHub repo and are just used for the demo.

    Read the article

  • how can I know current viewcontroller name in iphone

    - by Shikhar
    I have BaseView which implement UIViewController. Every view in project must implement this BaseView. In BaseView, I have method: -(void) checkLoginStatus { defaults = [[NSUserDefaults alloc] init]; if(![[defaults objectForKey:@"USERID"] length] > 0 ) { Login *login=[[Login alloc] initWithNibName:@"Login" bundle:nil]; [self.navigationController pushViewController:login animated:TRUE]; [login release]; } [defaults release]; } The problem is my Login view also implement BaseView, checks for login, and again open LoginView i.e. stuck in to recursive calling. Can I check in checkLoginStatus method if request is from LoginView then take no action else check login. Ex: (void) checkLoginStatus { if(SubView is NOT Login){ defaults = [[NSUserDefaults alloc] init]; if(![[defaults objectForKey:@"USERID"] length] 0 ) { Login *login=[[Login alloc] initWithNibName:@"Login" bundle:nil]; [self.navigationController pushViewController:login animated:TRUE]; [login release]; } [defaults release]; } } Please help..

    Read the article

  • NSTableView selection & highlights

    - by Christian
    I have a NSTableView as a very central part of my Application and want it to integrate more with the rest of it. It has only one column (it's a list) and I draw all Cells (normal NSTextFieldCells) myself. The first problem is the highlighting. I draw the highlight myself and want to get rid of the blue background. I now fill the whole cell with the original background color to hide the blue background, but this looks bad when dragging the cell around. I tried overriding highlight:withFrame:inView: and highlightColorWithFrame:inView: of NSCell but nothing happened. How can I disable automatic highlighting? I also want all rows/cells to be deselected when I click somewhere outside my NSTableView. Since the background / highlight of the selected cell turns gray there must be an event for this, but I can't find it. I let my cells expand on a double click and may need to undo this. So getting rid of the gray highlight is not enough. EDIT: I add a subview to the NSTableView when a cell gets double clicked and then resignFirstResponder of the NSTableView gets called. I tried this: - (BOOL)resignFirstResponder { if (![[self subviews] containsObject:[[self window] firstResponder]]) { [self deselectAll:self]; ... } return YES; } Besides that it's not working I would need to implement this method for all objects in the view hierarchy. Is there an other solution to find out when the first responder leaves a certain view hierarchy?

    Read the article

  • Tab bar application with UINavigation Controller MOC not being retained.

    - by iamsmug
    I created a tab bar application from the template and added a navigation controller to one of the tabs. I have already created this app from the navigation app template already and is working. The reason I am doing it this way is because I need to add a tab bar and thought it would be easier starting by using the tab bar project template and adding the nav controller to it rather than the other way round. I have copied the data model over from the other project and added the relevant code to where it should be. The problem I am having is passing the moc from the app delegate to the tab with the nav controller on. Here is a snippet from my applicationDidFinishLaunching method in my app delegate: - (void)applicationDidFinishLaunching:(UIApplication *)application { [self createEditableCopyOfDatabaseIfNeeded]; Top_BananaTableViewController *top_BananaTableViewController = (Top_BananaTableViewController *)[navigationController topViewController]; top_BananaTableViewController.managedObjectContext = self.managedObjectContext; // Add the tab bar controller's current view as a subview of the window [window addSubview:tabBarController.view]; [window makeKeyAndVisible]; } Everything seems fine here but when it comes to the fetchedResultsController on my nav controller view it bombs out with: '+entityForName: could not locate an NSManagedObjectModel for entity name 'cards'' When I checked what was set to my managedObjectContext on that view it was null. I don't know why or where it is loosing it's setting. Please help.

    Read the article

  • horizontal uiview's controls unresponsive.. or how to foul up a view hierarchy

    - by Oldmicah
    Hello all, I'm working on an app that has two sections, a config section and a results section. My config section needs to be 2 separate views (horizontal and vert, and yes, I can hear the intake of breath from here), with one rotatable view for the results. b/c of layout restraints and a lot of pain around rotation, I'm not using a navigation controller. I've been experiencing the joys of rotation experimentation and have settled upon keeping my views contained as subviews of my view controller. i.e. view controller.view.subviews = configH, configV, and results. I then use the controller.view bringSubviewToFront to bring the either the configH, configV, or the result view to the front. Rotation works-queue(humor intended) the angelic choirs... almost. What's happening is that my configV button's are responsive, but when the device (or simulator) is rotated, my configH controls are not. (configV is the second subview added, but the first one to be brought to the front because app comes up in portrait mode) The controls on the results view also work. Plan B was to assign the controller.view to configH, configV, or results. All of my controls now work, but rotation is now fouled up. Question 1: Is there a better way to do this? (a horizontal and vertical config view and a rotatable results view) Question 2: Does the above suggest a design issue, or is it more likely that my addled brain is just missing something in my own code. (nothing from the peanut gallery please) many thanks!

    Read the article

  • How to manage a single-selection (exclusive) list?

    - by Andy
    I've got a detail view that consists of a table view with a few rows of data. I can fill the rows just fine, and moving back and forth from the parent view to the subview works too. This detail view should allow the user to select a single value, placing a checkmark accessory in the cell and then returning to the parent view (where the selected value becomes the cell.textLabel.text property of the cell from which the detail view was called). This all works as of right now. However, when the user taps the cell in the parent view to go back to the detail view (to change their selection), my checkmark has disappeared and I cannot for the life of me figure out how to make it stay. Here's my cellForRowAtIndexPath: method: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; } NSString *labelText = [[phones objectAtIndex:indexPath.row] valueForKey:@"phoneNumberLabel"]; cell.textLabel.text = labelText; NSString *currentLabel = [ruleBuilder.tableView cellForRowAtIndexPath:selectedIndexPath].textLabel.text; if (labelText == currentLabel) { cell.accessoryType = UITableViewCellAccessoryCheckmark; } NSString *detailText = [[phones objectAtIndex:indexPath.row] valueForKey:@"phoneNumber"]; cell.detailTextLabel.text = detailText; return cell; } I've checked out Apple's sample code for exclusive-list management in Table View Programming Guide, but the snippet seems incomplete, and I can't find the related code in Apple's sample code. This doesn't seem like it ought to be that hard to do.

    Read the article

  • Why doesn't the SplitView iPhone template have a nib file for the RootView?

    - by Dr Dork
    I'm diving into iPad development and am learning a lot quickly, but everywhere I look, I have questions. After creating a new SplitView app in Xcode using the template, it generates the AppDelegate class, RootViewController class, and DetailViewController class. Along with that, it creates a .xib files for MainWinow.xib and DetailView.xib. How do these five files work together? Why is there a nib file for the DetailView, but not the RootView? When I double click on the MainWindow.xib file, Interface Builder launches without a "View" window, why? Below is the code for didFinishLaunchingWithOptions method inside the AppDelegate class. Why are we adding the splitViewController as a subview? (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after app launch rootViewController.managedObjectContext = self.managedObjectContext; // Add the split view controller's view to the window and display. [window addSubview:splitViewController.view]; [window makeKeyAndVisible]; return YES; } Thanks so much in advance for all your help! I still have a lot to learn, so I apologize if this question is absurd in any way. I'm going to continue researching these questions right now!

    Read the article

  • Custom UIButton Memory Management in dealloc

    - by ddawber
    I am hoping to clarify the processes going on here. I have created a subclass of UIButton whose init method looks like this: - (id)initWithTitle:(NSString *)title frame:(CGRect)btnFrame { self = [UIButton buttonWithType:UIButtonTypeCustom]; [self setTitle:title forState:UIControlStateNormal]; self.frame = btnFrame; return self; } In my view controller I am creating one of these buttons and adding it as a subview: myButton = [[CustomButton alloc] initWithTitle:@"Title" frame:someFrame]; [self.view addSubview:myButton]; In the view controller's dealloc method I log the retain count of my button: - (void)dealloc { NSLog(@"RC: %d", [myButton retainCount]); //RC = 2 [super dealloc]; NSLog(@"RC: %d", [myButton retainCount]); //RC = 1 } The way I understand it, myButton is not actually retained, even though I invoked it using alloc, because in my subclass I created an autorelease button (using buttonWithType:). In dealloc, does this mean that, when dealloc is called the superview releases the button and its retain count goes down to 1? The button has not yet been autoreleased? Or do I need to get that retain count down to zero after calling [super dealloc]? Cheers.

    Read the article

  • First and last UITableViewCell keep changing while scrolling.

    - by W Dyson
    I have a tableView with cells containing one UITextField as a subview for each cell. My problem is that when I scroll down, the text in the first cell is duplicated in the last cell. I can't for the life if me figure out why. I have tried loading the cells from different nibs, having the textFields as ivars. The UITextFields don't seem to be the problem, I'm thinking it has something to do with the tableView reusing the cells. The textFields all have a data source that keeps track of the text within the textField and the text is reset each time the cell is shown. Any ideas? UPDATE: Thanks guys, here's a sample: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"Section %i, Row %i", indexPath.section, indexPath.row); static NSString *JournalCellIdentifier = @"JournalCellIdentifier"; UITableViewCell *cell = (UITableViewCell *)[self.tableView dequeueReusableCellWithIdentifier:JournalCellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:JournalCellIdentifier] autorelease]; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.accessoryType = UITableViewCellAccessoryNone; } if (indexPath.section == 0) { UITextField *textField = (UITextField *)[self.authorCell viewWithTag:1]; [cell addSubview:textField]; self.authorTextField = textField; self.authorTextField.text = [self.textFieldDictionary objectForKey:@"author"]; NSLog(@"Reading Author:%@", [self.textFieldDictionary objectForKey:@"author"]); } else if (indexPath.section == 1) { UITextField *textField = (UITextField *)[self.yearCell viewWithTag:1]; [cell addSubview:textField]; self.yearTextField = textField; self.yearTextField.text = [self.textFieldDictionary objectForKey:@"year"]; NSLog(@"Reading Year:%@", [self.textFieldDictionary objectForKey:@"year"]); } else if (indexPath.section == 2) { UITextField *textField = (UITextField *)[self.volumeCell viewWithTag:1]; [cell addSubview:textField]; self.volumeTextField = textField; self.volumeTextField.text = [self.textFieldDictionary objectForKey:@"volume"]; NSLog(@"Reading Volume:%@", [self.textFieldDictionary objectForKey:@"volume"]); } return cell; }

    Read the article

  • iOS: display modal view over the top of a UIWebView

    - by Sly
    Is it possible to display a modal view over the top of a UIWebView? I have a UIViewController that loads a WebView. I then want to push a Modal View Controller over the top so that a modal view covers up the WebView temporarily... The WebView is working fine; here's how it's loaded in the View Controller: - (void)loadView { // Initialize webview and add as a subview to LandscapeController's view myWebView = [[[UIWebView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease]; myWebView.scalesPageToFit = YES; myWebView.autoresizesSubviews = YES; myWebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); myWebView.delegate = self; self.view = myWebView; } If I attempt to load a Modal View controller from within viewDidLoad, however, no modal view appears: - (void)viewDidLoad { [super viewDidLoad]; // Edit dcftable.html with updated figures NSMutableString *updated_html = [self _updateHTML:@"dcftable"]; // Load altered HTML file as an NSURL request [self.myWebView loadHTMLString:updated_html baseURL:nil]; // If user hasn't paid for dcftable, then invoke the covering modal view if (some_condition) { LandscapeCoverController *landscapeCoverController = [[[LandscapeCoverController alloc] init] autorelease ]; [self presentModalViewController:landscapeCoverController animated:YES]; } } I suspect that there's something that needs to be done with the UIWebView delegate to get it to receive the new modal view...but can't find any discussion or examples of this anywhere...again, the objective is to invoke a modal view that covers over the top of the WebView. Thanks for any thoughts in advance!

    Read the article

  • UIView scaled to thumbprint, what about subviews?

    - by Parad0x13
    I have a UIImageView that I create progmatically right? Works like a charm when I initWithImage and set the parameters for scaling to UIViewContentModeScaleToFill. I can scale all day long and create many different smaller 'thumbprint' sized versions of the UIImageView at whim, HOWEVER when I add subviews to said UIImageView and then try to scale the happy new parent the child subview does not scale! I looked around and found that I should enable the setAutoresizingSubviews boolean of the parentView to true (Which I did) and then call: ChildView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; Which I also did... now when I scale the parent view the child also scales but crazy wacked out like and goes all over the place (Not a very good way of putting it) but my point is that I assumed the child would scale proportionally to the parent and stay in the same place (Which it doesn't) My question is how do I set up my code so that when I scale my parent view by 1/4 or w/e to make a thumbprint of the view the children subviews that the parent view owns will scale accordingly and allow the 1/4 sized thumbprint to look just like the full sized view (Just smaller).

    Read the article

  • help in selecting a row in a tableview and pushing that row into anotherview? sturgling on this sinc

    - by Madhu
    Hi, I have a list of about 5 items in a tableview which I bought them from a database and now when i am trying to push each of them into different views in DidSelectRow() what I am seeing is it is showing me all the views in all the categories.... here is the code I have written.... Here is the code written in cell for row at indexpath: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } BeautyQuotes *bQuote = (BeautyQuotes*)[mBeautyQ objectAtIndex:indexPath.row]; cell.textLabel.text = bQuote.qBeauty; [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator] ; return cell; and in didselectrow() i have written this code: id count1 = [mBeautyQ count]; while (count1--) { object = [mBeautyQ objectAtIndex:count1]; } [mBeautyQ release]; if([[object objectAtIndex:indexPath.row] isEqual : @"Beauty Quotes"]){ [tableView deselectRowAtIndexPath:indexPath animated:NO]; BeautysubViewController *subBeauty = [[BeautysubViewController alloc] initWithNibName:@"BeautysubViewController" bundle:nil]; //subBeauty.selected =[regions objectAtIndex:indexPath.row];(this is not working) [subBeauty setTitle:@"Beauty Quotes"]; NSLog(@"it is about push beauty subview controller"); [self.navigationController pushViewController:subBeauty animated:YES]; [subBeauty release]; } in this way i am pusing all the rows in to different views....but when I am pushing this into beautyquotes it is showing me all other views along with this.... struggling on this a lot please help me in dealing with this....

    Read the article

  • Correct way to switch between UIView with ARC. My way leads to memory leaks :( (iOS)

    - by Andrei Golubev
    i use xcode 4.4 with ARC on.. I have dynamically created UIViews in the ViewController.m: UIView*myviews[10]; Then in the - (void)viewDidLoad function i fill each of it with pictures i need myviews[viewIndex] = [[UIView alloc]initWithFrame:myrec]; UIImage *testImg; UIImageView * testImgView; testImg = [UIImage imageNamed:[NSString stringWithFormat:@"imgarray%d.png", viewIndex]; testImgView.image = testImg; viewindex++; So all seems to be fine, when i want to jump from one view to another i do with two buttons next: [self.view addSubview:views[viewIndex]]; CATransition *animation = [CATransition animation]; [animation setDelegate:self]; [animation setDuration:1.0f]; [animation setType:@"rippleEffect"]; [animation setSubtype:kCATransitionFromTop]; //[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; [self.view.layer addAnimation:animation forKey:@"transitionViewAnimation"]; Nothing seems to be bad, but the memory consumption grows with huge speed when i switch between views.. and then i get low memory warning or sometimes application will just crash. I have tried to use UIViewController array and was switching between the controllers: nothing changes, the memory low warning is what i end up with.. Maybe i need to clean the memory somehow? But how? ARC does not allow to use release and so on.. last what i have tried (sorry, maybe not very professional) before to add new subview is this NSArray *viewsToRemove = [self.view subviews]; for (UIView *views in viewsToRemove) { [views removeFromSuperview]; } But this does not help either.. Please don't judge too strong, i am still new to iOS and Objective-c..

    Read the article

  • Why is my view controllers view not quadratic?

    - by mystify
    I created an UIViewController subclass, and figured out that the default implementation of -loadView in UIViewController will ignore my frame size settings in a strange way. To simplify it and to make sure it's really not the fault of my code, I did a clean test with a plain instance of UIViewController directly, rather than making a subclass. The result is the same. I try to make an exactly quadratic view of 320 x 320, but the view appears like 320 x 200. iPhone OS 3.0, please check this out: UIViewController *ts = [[UIViewController alloc] initWithNibName:nil bundle:nil]; ts.view.frame = CGRectMake(0.0f, 0.0f, 320.0f, 320.0f); ts.view.backgroundColor = [UIColor cyanColor]; [self.view addSubview:ts.view]; like you can see, I do this: 1) Create a UIViewController instance 2) Set the frame of the view to a quadratic dimension of 320 x 320 3) Give it a color, so I can see it 4) Added it as a subview. Now the part, that's even more strange: When I make my own implementation of -loadView, i.e. if I put this code in there like this: - (void)loadView { UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 320.0f)]; v.backgroundColor = [UIColor cyanColor]; self.view = v; [v release]; } then it looks right. Now lets think about that: In the first example, I do pretty much exactly the same, just that I let UIViewController create the view on it's own, and then take it over in order to change it's frame. Right? So why do I get this strange error? Right now I see no other way of messing around like that to correct this wrong behavior. I did not activate anything like clipsToBounds and there's no other code touching this.

    Read the article

  • Calling a method from another view in objective-c. (iphone sdk).

    - by MarcZero
    Hello. I am currently creating a multi-view game on the iPhone platform. I have my main view start to play some background music upon loading. I then go to another view and start the game. I am trying to get the background music from the original view to stop once I start the game. I am having trouble getting the stop playing music message to my original view. Here is the relevant info: The main view where the sound is played from is just a subView of the programViewController class called *viewController. The heading is in the programAppDelegate class. The sound is done using the AVAudioPlayer class and plays fine when the program starts up and when I navigate to other subviews that are added on by going through the menu system. In the view that I want to start the game, I attempt to call the instance of the class to turn of the player but anytime I use this format of code: [viewController #######]; It gives a build error of "viewController undeclared" no matter what I put after the "viewController" in the message.I have attempted to import the programAppDelegate.h file but it still gives the same error. I realize this might be a simple misunderstanding of the objective-c language but I cannot find any info on this issue. I am a recent convert from Java so I am trying to wrap my head around everything. Thank you for your time!

    Read the article

  • Adding UIView on top of all views dynamically during runtime?

    - by Easwaramoorthy Kanagaraj
    Team, I am trying to bring a menu in top of all visible views during runtime. This menu should be easily addable and removable dynamically in certain conditions. To do this, I have tried adding a button view to the UIWindow as a subview during runtime. UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [button addTarget:self action:nil forControlEvents:UIControlEventTouchDown]; [button setTitle:@"Show View" forState:UIControlStateNormal]; button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0); [window addSubview:button]; [window makeKeyAndVisible]; [window bringSubviewToFront:button]; But it doesnt worked. Also I have tried to place this button in the root view controller, but no luck again. Edit - Note: This code is not from a UIViewController. I am trying to build a library this will be in that library code. Use case be like you could post NSNotification to enable and disable this menu dynamically during runtime. Please suggest. Thanks !

    Read the article

  • Improving the efficiency of multiple concurrent Core Animation animations

    - by Alex
    I have a view in my app that is very similar to the month view in the built-in Calendar app. There's a subview that holds the individual cells (a custom UIView subclass that draws text into its layer), and when the user navigates to the next "month", I create the new cells and slide the view to show them. When the animation stops, I remove the old, hidden cells and set things up so it's ready to go for the next animation. This all works nicely. However, I'd like to animate the cells' text color, as in the Calendar app, so that the outgoing ones transition to a lighter color and the incoming ones transition to a darker color. The problems is that I can have as many as 70 cells, so doing individual animations is very slow -- between 5-10 fps on my iPhone 3GS. I'm trying to find a less computationally intense way of doing this. My reading of the Shark results is that the majority of the time is spent redrawing the text for each frame for each frame. This makes sense, since text rendering is hardly the cheapest operation. I've considered creating a second view -- one holding the "outgoing" state and one holding the "incoming" state and using a single opacity animation to gradually reveal the updated cells while both are sliding. I'm concerned that instead of having 70 cells, I'll have 140, which seems like a lot of views. So, is that too many views or would there be a better way of doing this?

    Read the article

  • MKMapView memory usage grows out of control with setRegion: calls

    - by Kurt
    Hi, I have a single MKMapView instance that I have programmatically added to a UIView. As part of the UI, the user can cycle through a list of addresses and the map view is updated to show the correct map for each address as the user goes through them. I create the map view once, and simply change what it displays with setRegion:animated:. The problem is that each time the map is changed to show a new address, the memory usage of my program increases by 200K-500K (as reported by Memory Monitor in Instruments). According to Object Allocations, it appears that a lot of 1.0K Mallocs are happening each time, and the Extended Detail pane for these 1.0K allocations shows that the Responsible Caller is convert_image_data and the Extended Detail pane shows that this is the result of [MKMapTileView drawLayer:inContext:]. So, seems likely to me that the memory usage is due to MKMapView not freeing memory it uses to redraw the map each time. In fact, when I don't display the map at all (by not even adding it as a subview of my main UIView) but still cycle through the addresses (which changes various UILabels and other displayed info) the memory usage for the app does NOT increase. If I add the map view but never update it with setRegion:, the memory also does NOT increase when changing to a new address. One more bit of info: if I go to a new address (and therefore ask the map to display the new address) the memory jumps as described above. However, if I go back to an address that was already displayed, the memory does not jump when the map redraws with the old address. Also, this happens on iPad (real device) with 3.2 and on iPhone (again, real device) with 3.1.2. Here's how I initialize the MKMapView (I only do this once): CGRect mapFrame; mapFrame.origin.y = 460; // yes, magic numbers. just for testing. mapFrame.origin.x = 0; mapFrame.size.height = 500; mapFrame.size.width = 768; mapView = [[MKMapView alloc] initWithFrame:mapFrame]; mapView.delegate = self; [self.view insertSubview:mapView atIndex:0]; And in response to the user selecting an address, I set the map like so: MKCoordinateRegion region; MKCoordinateSpan span; span.latitudeDelta=kStreetMapSpan; // 0.003 span.longitudeDelta=kStreetMapSpan; // 0.003 region.center = address.coords; // coords is CLLocationCoordinate2D region.span = span; mapView.region.span = span; [mapView setRegion:region animated:NO]; Any thoughts? I've scoured the net but haven't seen mention of this problem, and I've reached the limits of my Instruments knowledge. Thanks for any ideas.

    Read the article

< Previous Page | 10 11 12 13 14 15  | Next Page >