Search Results

Search found 825 results on 33 pages for 'uiviewcontroller'.

Page 9/33 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • iPad UIViewController loads as portrait when device is in landscape

    - by jud
    I have an application with 3 view controllers. They are all have shouldAutoRotateToInterfaceOrientation returning YES. The first two, my main menu and my submenu both autorotate just fine. The third viewcontroller, which programatically loads a UIImageView from a jpg file in the program's bundle, will only display in portrait. In the viewcontroller containing the image, i have this: NSString *imageName = [NSString stringWithFormat:@"%@-00%d.jpg",setPrefix,imageNumber]; UIImageView *pictureView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName]]; pictureView.frame = CGRectMake(0, 0, 1024, 768); [self.view addSubview:pictureView]; and again, I have shouldAutoRotateToInterfaceOrientation returning YES for all orientations. My image shows up, but is sideways, and the 0,0,1024,768 values I used to make my rectangle start from the top right corner going down, instead of starting at the top left and going across (holding in landscape). Am I missing a parameter I need to set in order to ensure the imageview shows up in landscape instead of portrait?

    Read the article

  • Changing UIView on orientation change

    - by Designeveloper
    Hey all. I have a fairly simple question. I am developing a "rich" iPad app, and I have two background images specifically designed for landscape and portrait. I'd like this ImageView to automatically change depending on the devices orientation. (like pretty much all of Apples iPad apps). Can anyone point me in the right direction? I'm assuming it would be something I do on viewDidLoad..

    Read the article

  • Add UIBarButtonItem in interface builder, how to?

    - by Martin
    I have a navigation based application that have a uinavigataioncontroller containing uitableviewcontrollers. I want to add buttons to the UINavigationbar of the uinavigataioncontroller, usually I write code to add these buttons, something like this: UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(saveClicked:)]; self.navigationItem.rightBarButtonItem = saveButton; [saveButton release]; My idea now was to use interface builder instead. But I'm not sure how to do it. What I'm trying to do is to add a UINavigationItem in the xib file of the viewcontroller (my viewcontroller is called TextViewController), something like this: See this image: http://i48.tinypic.com/qq5yk7.jpg But how can I make TextViewController use the UINavigationItem I added? The button I add doesn't show in the navigationbar. Any ideas on how to do this? What am I missing?

    Read the article

  • iPhone sdk, at dismissModalViewcontrollerAnimated, the parent change y origin coordinate

    - by DigitalVanilla
    Hi guys, my first post here :) I'm having a small trouble with a small but boring problem. I have a view, with a NavigationController. I load in the NC a simple view. Inside this view there's abutton where I fire the presentModalView... in the main view, not on NC, but it's parent view: ABVIEW NC NEWVIEW new attach a presentModalView... on ABVIEW, so [abview present...]; No problem till now. When it's the time to dismiss, after the temporary window (let's calls it NOTES) disappear, my ABVIEW with all the subviews change Y position from 0 to 20, the same height of the status bar. I was looking everywhere and I'm sure it's a stupid thing, but I miss a bit of knowledge here and I have no idea where to find the solution. thanks in advance!

    Read the article

  • Problem after dismissing a modal view used in conjunction with a uisplitviewcontroller

    - by user336274
    I'm having a hard time understanding why the following is happening (and how to fix it). I've created an application using the split-view based application. I've added a UiBarButtonItem called showTheModal which calls this method found in RootViewController.m: - (IBAction)showTheModal:(id)sender { theModalController.modalPresentationStyle = UIModalPresentationFullScreen; theModalController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentModalViewController:theModalController animated:YES]; if ([detailViewController popoverController] != nil) [[detailViewController popoverController] dismissPopoverAnimated:YES]; The BarButtonItem of course, is shown at the bottom of the Default Root Controller (left side of the of the split view in landscape) or at the bottom of the popup (if in landscape). The modal view is dismissed by a button placed in a toolbar. It calls the following: [self dismissModalViewControllerAnimated: YES]; The problem I'm having is if rotate the screen, while the modal is up. Here is what happens in different scenarios (start refers to the orientation when the showTheModal button is hit, end refers to the orientation when I hit the dismissModal button). 1)Start landscape, end landscape: Everything appears fine. willHideViewController and willShowViewController methods are not called in the RootViewController (as expected) 2) Start landscape, end portrait: UI appears fine. willHideViewController is run TWICE (WHY?) 3) Start portrait, end portrait: UI appears fine. willHideViewController is run once (as expected) 4) Start portrait, end landscape: The 'Root List' button remains in the detail view (right side of the split view. Neither willHideViewController and willShowViewController are invoked (WHY??) Any thoughts as to why #2 and #4 don't behave quite the expected way?

    Read the article

  • Can a View Controller manage more than 1 nib based view?

    - by Hugo Brynjar
    I have a VC controlling a screen of content that has 2 modes; a normal mode and an edit mode. Can I create a single VC with 2 views, each from separate nibs? In many situations on the iphone, you have a VC which controls an associated view. Then on a button press or other event, a new VC is loaded and its view becomes the top level view etc. But in this situation, I have 2 modes that I want to use the same VC for, because they are closely related. So I want a VC which can swap in/out 2 views. As per here: http://stackoverflow.com/questions/863321/iphone-how-to-load-a-view-using-a-nib-file-created-with-interface-builder/2683153#2683153 I have found that I can load a VC with an associated view from a nib and then later on load a different view from another nib and make that new view the active view. NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"EditMode" owner:self options:nil]; UIView *theEditView = [nibObjects objectAtIndex:0]; self.editView = theEditView; [self.view addSubview:theEditView]; The secondary nib has outlets wired up to the VC like the primary nib. When the new nib is loaded, the outlets are all connected up fine and everything works nicely. Unfortunately when this edit view is then removed, there doesn't seem to be any elegant way of getting the outlets hooked up again to the (normal mode) view from the original nib. Nib loading and outlet setting seems a once only thing. So, if you want to have a VC that swaps in/out 2 views without creating a new VC, what are the options? 1) You can do everything in code, but I want to use nibs because it makes creating the UI simpler. 2) You have 1 nib for your VC and just hide/show elements using the hidden property of UIView and its subclasses. 3) You load a new nib as described above. This is fine for the new nib, but how do you sort the outlets when you go back to the original nib. 4) Give up and accept having a 1:1 between VCs and nibs. There is a nib for normal mode, a nib for edit mode and each mode has a VC that subclasses a common superclass. In the end, I went with 4) and it works, but requires a fair amount of extra work, because I have a model class that I instantiate in normal mode and then have to pass to the edit mode VC because both modes need access to the model. I'm also using NSTimer and have to start and stop the timer in each mode. It is because of all this shared functionality that I wanted a single VC with 2 nibs in the first place.

    Read the article

  • iPhone app: recover view after didReceiveMemoryWarning

    - by mga
    The app in question has a MainView->ModalView pair. The ModalView is shown via UIModalTransitionStyleFlipHorizontal. In case of didReceiveMemoryWarning, MainView is dumped (since it is not visible) and the app stays "alive" but when you flip back there is a (very) short period of time when the screen is blank (since the modal dialog is returning to a now-deallocated view). When the animation transition is over, MainView is regenerated and all is ok. I just would like to somehow regenerate MainView before returning from ModalView (in case of a memory warning). Is this a good idea? Am I doing something wrong as far as the warning is concerned? Thanks

    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

  • Popping UIView crashes app

    - by Adun
    I'm basically pushing a UIView from a UITableViewController and all it contains is a UIWebView. However when I remove the UIView to return back to the UITableView the app crashes. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic may go here. Create and push another view controller. if (indexPath.row == websiteCell) { NSString *urlPath = [NSString stringWithFormat:@"http://%@", exhibitor.website]; WebViewController *webViewController = [[WebViewController alloc] initWithURLString:urlPath]; // Pass the selected object to the new view controller. [self.parentViewController presentModalViewController:webViewController animated:YES]; [webViewController release]; } } If I comment out the [webViewController release] the app doesn't crash, but I know that this would be a leak. Below is the code for the Web Browser: #import "WebViewController.h" @implementation WebViewController @synthesize webBrowserView; @synthesize urlValue; @synthesize toolBar; @synthesize spinner; @synthesize loadUrl; -(id)initWithURLString:(NSString *)urlString { if (self = [super init]) { urlValue = urlString; } return self; } #pragma mark WebView Controls - (void)goBack { [webBrowserView goBack]; } - (void)goForward { [webBrowserView goForward]; } - (void)reload { [webBrowserView reload]; } - (void)closeBrowser { [self.parentViewController dismissModalViewControllerAnimated:YES]; } #pragma end // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; CGRect contentRect = self.view.bounds; //NSLog(@"%f", contentRect.size.height); float webViewHeight = contentRect.size.height - 44.0f; // navBar = 44 float toolBarHeight = contentRect.size.height - webViewHeight; // navigation bar UINavigationBar *navBar = [[[UINavigationBar alloc] initWithFrame:CGRectMake(0, 20, contentRect.size.width, 44)] autorelease]; navBar.delegate = self; UIBarButtonItem *doneButton = [[[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:nil action:@selector(closeBrowser)] autorelease]; UINavigationItem *item = [[[UINavigationItem alloc] initWithTitle:@"CEDIA10"] autorelease]; item.leftBarButtonItem = doneButton; [navBar pushNavigationItem:item animated:NO]; [self.view addSubview:navBar]; // web browser webBrowserView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 64, contentRect.size.width, webViewHeight)]; webBrowserView.delegate = self; webBrowserView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; webBrowserView.scalesPageToFit = YES; [self.view addSubview:webBrowserView]; // buttons UIBarButtonItem *backButton = [[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"arrowleft.png"] style:UIBarButtonItemStylePlain target:self action:@selector(goBack)] autorelease]; UIBarButtonItem *fwdButton = [[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"arrowright.png"] style:UIBarButtonItemStylePlain target:self action:@selector(goForward)] autorelease]; UIBarButtonItem *refreshButton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(reload)] autorelease]; UIBarButtonItem *flexSpace = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil] autorelease]; UIBarButtonItem *fixSpace = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil] autorelease]; [fixSpace setWidth: 40.0f]; spinner = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite] autorelease]; [spinner startAnimating]; UIBarButtonItem *loadingIcon = [[[UIBarButtonItem alloc] initWithCustomView:spinner] autorelease]; NSArray *toolBarButtons = [[NSArray alloc] initWithObjects: fixSpace, backButton, fixSpace, fwdButton, flexSpace, loadingIcon, flexSpace, refreshButton, nil]; // toolbar toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, webViewHeight, contentRect.size.width, toolBarHeight)]; toolBar.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth; toolBar.items = toolBarButtons; [self.view addSubview:toolBar]; // load the request NSURL *requestString = [NSURL URLWithString:urlValue]; [webBrowserView loadRequest:[NSURLRequest requestWithURL: requestString]]; [toolBarButtons release]; } - (void)viewWillDisappear { if ([webBrowserView isLoading]) { [webBrowserView stopLoading]; webBrowserView.delegate = nil; } } #pragma mark UIWebView - (void)webViewDidStartLoad:(UIWebView*)webView { [spinner startAnimating]; } - (void)webViewDidFinishLoad:(UIWebView*)webView { [spinner stopAnimating]; } - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { loadUrl = [[request URL] retain]; if ([[loadUrl scheme] isEqualToString: @"mailto"]) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"CEDIA10" message:@"Do you want to open Mail and exit AREC10?" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes",nil]; [alert show]; [alert release]; return NO; } [loadUrl release]; return YES; } - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { [spinner stopAnimating]; if (error.code == -1009) { // no internet connection UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"CEDIA10" message:@"You need an active Internet connection." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; } } #pragma mark UIAlertView - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex == 1) { [[UIApplication sharedApplication] openURL:loadUrl]; [loadUrl 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. [webBrowserView release]; [urlValue release]; [toolBar release]; [spinner release]; [loadUrl release]; webBrowserView = nil; webBrowserView.delegate = nil; urlValue = nil; toolBar = nil; spinner = nil; loadUrl = nil; } - (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [webBrowserView release]; [urlValue release]; [toolBar release]; [spinner release]; [loadUrl release]; webBrowserView.delegate = nil; urlValue = nil; toolBar = nil; spinner = nil; loadUrl = nil; [super dealloc]; } @end Below this is the crash log that I am getting: Date/Time: 2010-05-13 11:58:20.023 +1000 OS Version: iPhone OS 3.1.3 (7E18) Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x00000000, 0x00000000 Crashed Thread: 0 Thread 0 Crashed: 0 libSystem.B.dylib 0x00090b2c __kill + 8 1 libSystem.B.dylib 0x00090b1a kill + 4 2 libSystem.B.dylib 0x00090b0e raise + 10 3 libSystem.B.dylib 0x000a7e34 abort + 36 4 libstdc++.6.dylib 0x00066390 __gnu_cxx::__verbose_terminate_handler() + 588 5 libobjc.A.dylib 0x00008898 _objc_terminate + 160 6 libstdc++.6.dylib 0x00063a84 __cxxabiv1::__terminate(void (*)()) + 76 7 libstdc++.6.dylib 0x00063afc std::terminate() + 16 8 libstdc++.6.dylib 0x00063c24 __cxa_throw + 100 9 libobjc.A.dylib 0x00006e54 objc_exception_throw + 104 10 CoreFoundation 0x00095bf6 -[NSObject doesNotRecognizeSelector:] + 106 11 CoreFoundation 0x0001ab12 ___forwarding___ + 474 12 CoreFoundation 0x00011838 _CF_forwarding_prep_0 + 40 13 QuartzCore 0x0000f448 CALayerCopyRenderLayer + 24 14 QuartzCore 0x0000f048 CA::Context::commit_layer(_CALayer*, unsigned int, unsigned int, void*) + 100 15 QuartzCore 0x0000ef34 CALayerCommitIfNeeded + 336 16 QuartzCore 0x0000eedc CALayerCommitIfNeeded + 248 17 QuartzCore 0x00011ee8 CA::Context::commit_root(void*, void*) + 52 18 QuartzCore 0x00011e80 x_hash_table_foreach + 64 19 QuartzCore 0x00011e2c CA::Transaction::foreach_root(void (*)(void*, void*), void*) + 40 20 QuartzCore 0x0000bb68 CA::Context::commit_transaction(CA::Transaction*) + 1068 21 QuartzCore 0x0000b46c CA::Transaction::commit() + 276 22 QuartzCore 0x000135d4 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 84 23 CoreFoundation 0x0000f82a __CFRunLoopDoObservers + 466 24 CoreFoundation 0x00057340 CFRunLoopRunSpecific + 1812 25 CoreFoundation 0x00056c18 CFRunLoopRunInMode + 44 26 GraphicsServices 0x000041c0 GSEventRunModal + 188 27 UIKit 0x00003c28 -[UIApplication _run] + 552 28 UIKit 0x00002228 UIApplicationMain + 960 29 CEDIA10 0x00002e16 main (main.m:14) 30 CEDIA10 0x00002db8 start + 32 Any ideas on why the app is crashing?

    Read the article

  • TableView frame not resizing properly when pushing a new view controller and the keyboard is hiding

    - by Pete
    Hi, I must be missing something fundamental here. I have a UITableView inside of a NavigationViewController. When a table row is selected in the UITableView (using tableView:didSelectRowAtIndexPath:) I call pushViewController to display a different view controller. The new view controller appears correctly, but when I pop that view controller and return the UITableView is resized as if the keyboard was being displayed. I need to find a way to have the keyboard hide before I push the view controller so that the frame is restored correctly. If I comment out the code to push the view controller then the keyboard hides correctly and the frame resizes correctly. The code I use to show the keyboard is as follows: - (void) keyboardDidShowNotification:(NSNotification *)inNotification { NSLog(@"Keyboard Show"); if (keyboardVisible) return; // We now resize the view accordingly to accomodate the keyboard being visible keyboardVisible = YES; CGRect bounds = [[[inNotification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue]; bounds = [self.view convertRect:bounds fromView:nil]; CGRect tableFrame = tableViewNewEntry.frame; tableFrame.size.height -= bounds.size.height; // subtract the keyboard height if (self.tabBarController != nil) { tableFrame.size.height += 48; // add the tab bar height } [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(shrinkDidEnd:finished:contextInfo:)]; tableViewNewEntry.frame = tableFrame; [UIView commitAnimations]; } The keyboard is hidden using: - (void) keyboardWillHideNotification:(NSNotification *)inNotification { if (!keyboardVisible) return; NSLog(@"Keyboard Hide"); keyboardVisible = FALSE; CGRect bounds = [[[inNotification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue]; bounds = [self.view convertRect:bounds fromView:nil]; CGRect tableFrame = tableViewNewEntry.frame; tableFrame.size.height += bounds.size.height; // add the keyboard height if (self.tabBarController != nil) { tableFrame.size.height -= 48; // subtract the tab bar height } tableViewNewEntry.frame = tableFrame; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(_shrinkDidEnd:finished:contextInfo:)]; tableViewNewEntry.frame = tableFrame; [UIView commitAnimations]; [tableViewNewEntry scrollToNearestSelectedRowAtScrollPosition:UITableViewScrollPositionMiddle animated:YES]; NSLog(@"Keyboard Hide Finished"); } I trigger the keyboard being hidden by resigning first responser for any control that is the first responder in ViewWillDisappear. I have added NSLog statements and see things happening in the log file as follows: Show Keyboard ViewWillDisappear: Hiding Keyboard Hide Keyboard Keyboard Hide Finished PushViewController (an NSLog entry at the point I push the new view controller) From this trace, I can see things happening in the right order, but It seems like when the view controller is pushed that the keyboard hide code does not execute properly. Any ideas would be really appreciated. I have been banging my head against the keyboard for a while trying to find out what I am doing wrong.

    Read the article

  • Dismissing a modal view in horizontal orientation?

    - by Sheehan Alam
    I have a modal view that is presented and dismissed fine when my device is in vertical orientation. I have problems when my modal view is presented in the vertical orientation, but dismissed in horizontal orientation. The entire app switches back to vertical orientation automatically. How can I ensure that if I am in horizontal orientation, the view should dismiss properly?

    Read the article

  • iPhone OpenGL Splash Screen? How?

    - by Kyle
    My app is based pretty much on the EAGLView in the SDK. It doesn't incorporate a ViewController. Rather it simply inits GL and starts painting immediately.. Currently, my app will load a very small PNG and displays it as quickly as possible. On a 3GS this is rather instant, but on a 3G it can take about 2 seconds. In the latter case of the 3G, the user is looking at a black screen for that time. Is this behavior allowed by Apple? Is there any way to alter this SDK example so that it makes use of 'default.png'? It doesn't seem so straight forward to me. I want my user to see an image as quickly as possible, and I also don't want to be rejected for such a little quirk like this as well. In the guidelines, they encourage you to use default.png for standard applications to show a sort of mockup of the interface while it actually loads. I want to initialize OpenGL, and ALSO display this. This default.png is loaded before the app screen launches. This is EXACLTY what I want to make use of. Any help is appreciated. Thanks!

    Read the article

  • Create a Editable Grid View as in iBooks

    - by tilomitra
    There have been some similar questions asked regarding Grid views, but none have been sufficiently answered (some have been left unanswered as the SDKs were under NDAs at the time). The question is: Can anyone direct me towards a tutorial, or explain to me what steps to take to create a Grid View similar to iBooks, or the Yahoo! Entertainment app on the iPhone? Here's a screenshot of what I mean.

    Read the article

  • PoptorootViewController fails then removes all Viewcontrollers

    - by Spyker
    Trying to fix a very strange error, i have 3 view controllers that start from the app delegate and push each other accordingly. The 3rd view controller then has a toolbar button that calls the code here: -(void)showEventBrowser; { accelManeger.delegate = nil; NSLog(@"%u",[self.navigationController.viewControllers count]); [self.navigationController popToRootViewControllerAnimated:NO]; } This works the first time round but when i come back to this view controller and try again. Firstly it reports that there are 3 view controllers on the stack. It then deallocs the 2nd view controller in the stack and doesnt crash but will not go any further. If i hit the button again it says there are no view controllers on the stack and fails to respond. I have logs for all the viewdid, viewwill, e.t.c in each view controller and there appears to be no odd behaviour. Also no memory warnings from any view controllers. Why would this work once through but not the second time ?

    Read the article

  • How can UISearchDisplayController autorelease cause crash in a different view controller?

    - by Tofrizer
    Hi, I have two view controllers A and B. From A, I navigate to view controller B as follows: // in View Controller A // navigateToB method -(void) navigateToB { BViewController *bViewController = [[BViewController alloc] initWithNibName: @"BView" bundle:nil]; bViewController.bProperty1 = SOME_STRING_CONSTANT; bViewController.title = @"A TITLE OF A VC's CHOOSING"; [self.navigationController pushViewController: bViewController animated:YES]; [bViewController release]; //<----- releasing 0x406c1e0 } In BViewController, the property bPropery1 is defined with copy as below (note, B also contains UITableView and other properties): @property (nonatomic, copy) NSString *bProperty1; Everything appeared to work fine when navigating back and forth between A and B. That is until I added a UISearchDisplayController to the table view contained in BViewController. Now when I navigate out of B, back to A, the app crashes. Stack trace shows what looks the search display controller being autoreleased at time of crash: #0 0x009663a7 in ___forwarding___ #1 0x009426c2 in __forwarding_prep_0___ #2 0x018c8539 in -[UISearchDisplayController _destroyManagedTableView] #3 0x018c8ea4 in -[UISearchDisplayController dealloc] #4 0x00285ce5 in NSPopAutoreleasePool NSZombies shows: -[BViewController respondsToSelector:]: message sent to deallocated instance 0x406c1e0 And malloc history on this points to the bViewController already released in A's navigateToB method above: Call [2] [arg=132]: thread_a065e720 |start ... <snip> ..._sendActionsForEvents:withEvent:] | -[UIControl sendAction:to:forEvent:] | - [UIApplication sendAction:to:from:forEvent:] | -[**AViewController navigateToB**] | +[NSObject alloc] | +[NSObject allocWithZone:] | _internal_class_createInstance | _internal_class_createInstanceFromZone | calloc | malloc_zone_calloc Can someone please give me any ideas on what is happening here? In navigateToB method, once the bViewController is released (after pushViewController), that's should be it for bViewController. Nothing else even knows about it as it is local to the navigateToB method block and it has been released. When navigating from B back to A, nothing is invoked in viewDidLoad, viewWillAppear etc that will re-enter navigateToB. It looks like somehow search display controller has a reference to something in my AViewController and so as it is autoreleased it is taking this "something" down with it but I cannot understand how this is possible, especially as I'm using copy to pass data between A and B. I'm going potty over this. I'm sure this is my mistake somewhere and so I turn to you, Stack Overflow legends for any words of wisdom or advice on how to resolve this. Many Thanks.

    Read the article

  • iPhone Landscape FAQ and Solutions

    - by Johannes Rudolph
    There has been a lot of confusion and a set of corresponding set of questions here on SO how iPhone applications with proper handling for Landscape/Portrait mode autorotation can be implemented. It is especially difficult to implement such an application when starting in landscape mode is desired. The most common observed effect are scrambled layouts and areas of the screen where touches are no longer recognized. A simple search for questions tagged iphone and landscape reveals these issues, which occur under certain scenarios: Landscape only iPhone app with multiple nibs: App started in Landscape mode, view from first nib is rendered fine, everything view loaded from a different nib is not displayed correctly. Iphone Landscape mode switching to Portraite mode on loading new controller: Self explanatory iPhone: In landscape-only, after first addSubview, UITableViewController doesn’t rotate properly: Same issue as above. iPhone Landscape-Only Utility-Template Application: Layout errors, controller does not seem to recognize the view should be rotated but displays a clipped portrait view in landscape mode, causing half of the screen to stay blank. presentModalViewController in landscape after portrait viewController: Modal views are not correctly rendered either. A set of different solutions have been presented, some of them including completely custom animation via CoreGraphics, while others build on the observation that the first view controller loaded from the main nib is always displayed correct. I have spent a significant amount of time investigating this issue and finally found a solution that is not only a partial solution but should work under all these circumstances. It is my intend with this CW post to provide sort of a FAQ for others having issues with UIViewControllers in Landscape mode. Please provide feedback and help improve the quality of this Post by incorporating any related observations. Feel free to edit and post other/better answers if you know of any.

    Read the article

  • How to Unload a popped view controller?

    - by RexOnRoids
    Using a navigation based view hierarchy. I have a root view controller, and multiple view controllers that branch out from the same when a button is pressed. When a user presses the back button on the UINavigationBar, the current viewcontroller is popped and the display animates back to the rootviewcontroller. The problem is, I want the viewcontrollers to UNLOAD whenever they are popped. Seems like they are not unloading because when I go back to them they are still in the state they were when they were popped. How do I unload the viewcontrollers after navigating back to the rootviewcontroller?

    Read the article

  • Saving data - does work on Simulator, not on Device

    - by Peter Hajas
    I use NSData to persist an image in my application. I save the image like so (in my App Delegate): - (void)applicationWillTerminate:(UIApplication *)application { NSLog(@"Saving data"); NSData *data = UIImagePNGRepresentation([[viewController.myViewController myImage]image]); //Write the file out! NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path_to_file = [documentsDirectory stringByAppendingString:@"lastimage.png"]; [data writeToFile:path_to_file atomically:YES]; NSLog(@"Data saved."); } and then I load it back like so (in my view controller, under viewDidLoad): NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path_to_file = [documentsDirectory stringByAppendingString:@"lastimage.png"]; if([[NSFileManager defaultManager] fileExistsAtPath:path_to_file]) { NSLog(@"Found saved file, loading in image"); NSData *data = [NSData dataWithContentsOfFile:path_to_file]; UIImage *temp = [[UIImage alloc] initWithData:data]; myViewController.myImage.image = temp; NSLog(@"Finished loading in image"); } This code works every time on the simulator, but on the device, it can never seem to load back in the image. I'm pretty sure that it saves out, but I have no view of the filesystem. Am I doing something weird? Does the simulator have a different way to access its directories than the device? Thanks!

    Read the article

  • Easiest way to support multiple orientations? How do I load a custom NIB when the application is in

    - by Peter Hajas
    Hi there, I have an application in which I would like to support multiple orientations. I have two .xib files that I want to use, myViewController.xib and myViewControllerLandscape.xib. myViewController.xib exists in project/Resources and myViewControllerLandscape.xib exists in the root project directory. What I want to do is use a separate NIB (myViewControllerLandscape.xib) for my rotations. I try detecting rotation in viewDidLoad like this: if((self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (self.interfaceOrientation == UIInterfaceOrientationLandscapeRight)) { NSLog(@"Landscape detected!"); [self initWithNibName:@"myViewControllerLandscape" bundle:nil]; } But I can see in gdb that this isn't executed when the app is started with the device in landscape. The NSLog message doesn't fire. Why is this? What have I done wrong? Also, if I explicitly put the initWithNibName function call in the viewDidLoad method, that nib is not loaded, and it continues with the myViewController.xib file. What's wrong with my call? Should I specify a bundle? Thanks!

    Read the article

  • how to create iPhone main menu screen with 2 tabbars subview ?

    - by Boaz
    Hi. I made two applications that each one of them is tabbar based. Now I want to combine them to one app that will be struct like that: -Main menu with 2 buttones. - button 1: tab bar app no 1. - button 2: tab bar app no 2. from each tab bar app, I want an Home button on the left side of the nav bar that will take me to the main menu. I found this link http://www.pushplay.net/blog_detail.php?id=27 but it's not good to me.. I will be happy if you will able to post some simple code for my problem.. Thanks.

    Read the article

  • Circular Dependency of Navigation Control in iPhone

    - by Taimur Hamza
    Hi everyone , In my view this is one of the strangest problem i have ever come across in iPhone app development. Let me explain the scenario , i have main screen 'A' on which i have a Button that directs me to another Screen say 'B'. Now on Screen 'B' i have a feature in which user can send a mail to his friend for promotion purpose e.g a user wishes to tell a frnd about this app so i used MFMailComposeViewController and a view is generated where the user types the address and click send ( subject and body of mail is automatically generated ). After sending the mail a new view opens say screen 'C' and here i want to give the user the options . 1. Go to Screen 'A' ( which is main screen of the app ) 2. Go back to Screen 'B' ( from where the user requested to send a mail to his frnd ). Now the strange part i cannot declare the variables ( Screen 'A' and 'B' ) of both these files here at in header file of screen 'C' . Even when i declare the header file at the top it generates an error. The variables can be easily be declared and used for other screens but not for these 2 screens. Can anybody please explain wats the problem.? this the text of the error "/Users/admin/Documents/AppName/Classes/A.h:42: error: expected specifier-qualifier-list before 'B'" Thanks Guys ! Taimur

    Read the article

  • UINavigationController flashes white when I add it to a superview

    - by Chris Stamper
    Hey guys, I'm adding a NavigationController as a subview of my main view, with the flip animation (like a utility app/flipview thing). Here's how I'm doing it: [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:.7]; [UIView setAnimationTransition:([self.tableController.view superview] ? UIViewAnimationTransitionFlipFromLeft : UIViewAnimationTransitionFlipFromRight) forView:self.tableHostView cache:YES]; [self.tableController.view removeFromSuperview]; settingsView* backView1 = [[settingsView alloc] initWithNibName:@"settingsView" bundle:nil]; backView1.delegate = self; UINavigationController* settingsNavStack = [[UINavigationController alloc]initWithRootViewController:backView1]; [backView1 release]; settingsNavStack.view.frame = CGRectMake(0, 0, 320, 460); settingsNavStack.navigationItem.title = @"Settings"; [self setBackView:settingsNavStack]; [settingsNavStack release]; [self.tableHostView addSubview:self.backView.view]; [[self backView]setDelegate: self]; When it loads, the view comes in very nicely. However, the navigation bar stays white until like .2 secs after the animation finishes. Anyone know why the navigation bar wouldn't display right away?

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >