Search Results

Search found 359 results on 15 pages for 'xib'.

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

  • Sharing NSMutableArray

    - by Lucas Veiga
    Hey everbody, im trying to share a NSMutableArray to another xib. The cartList.codigo is a NSMutableArray from a shared class, according to James Brannan's tutorial (http://www.vimeo.com/12164589). When i count it, it gives me 1. But when i load the another view, gives me 0. Whats wrong? View that adds: self.produtoCodigo = [[NSMutableArray alloc]init]; [self.produtoCodigo addObject:@"aa"]; CartViewController *carrinho = [[CartViewController alloc] initWithNibName:@"CartViewController" bundle:[NSBundle mainBundle]]; CartList *lista = [[CartList alloc] init]; carrinho.cartList = lista; carrinho.cartList.codigo = self.produtoCodigo; NSLog(@"QTD %i", [carrinho.cartList.codigo count]); View that wants to load the item added: - (void) viewDidAppear:(BOOL)animated { self.produtoCodigo = self.cartList.codigo; NSLog(@"%i", [self.produtoCodigo count]); [super viewDidLoad]; } Im loading the CartList class in both. Thanks!

    Read the article

  • UINavigationController from scratch?

    - by Moshe
    I have a view based app that works well. (In other words, I'm not going to start over with a Navigation-Based App template.) It's an immersive app of sorts and I'm trying to add a Table View that loads in a new view when a button is pressed. The loading the nib part works, but I can't seem to be able to add a navigation controller to the new view. I want to see a navigation bar on top with a done button and an edit button. Also, I want to the Table View entries to be empty. I added a new file like so: File-> New File -> UINavigationController subclass. I checked the UITableViewController Subclass and With XIB for user interface. All I see when the view is pulled up is a blank Table View. I am able to customize things in the view controller. What can I do to make the table show a navigation bar and be editable? I need some direction here please. EDIT: I'm working with the latest Public SDK. (XCode 3.2.2)

    Read the article

  • UIWebView autosize issue only on iOS 4.3

    - by troop231
    I am trying to figure out how to fix this bug that only occurs on iOS 4.3. When the application launches, it displays a PDF that is scaled to fit in the UIWebView. It behaves perfectly until you pinch to zoom on the document, and then rotate it, leaving behind a black area. If you don't pinch to zoom, it doesn't leave the black area. I don't understand why this is a iOS 4.3 only issue. Screenshot of the issue: I've been trying to solve this problem awhile now, and would greatly appreciate your help. Thank you. Screenshots of the .xib settings: The code I'm using is: .h: #import <UIKit/UIKit.h> @interface ViewController : UIViewController { UIWebView *webView; } @property (nonatomic) IBOutlet UIWebView *webView; @end .m: #import "ViewController.h" @interface ViewController () @end @implementation ViewController @synthesize webView; - (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { return YES; } else { return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); } } - (void)viewDidLoad { [super viewDidLoad]; NSString *urlAddress = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"pdf"]; NSURL *url = [NSURL fileURLWithPath:urlAddress]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [webView loadRequest:requestObj]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } @end

    Read the article

  • UiButton / IBAction - link from a RootView to mainView in Storyboard

    - by webschnecke
    I try to call the main ViewController on my storyboard. In my app there is a additional .h, .m file with no xib or storyboard. In this .m file T craeted a button: UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [button addTarget:self action:@selector(home:)forControlEvents:UIControlEventTouchDown]; [button setTitle:@"Show View" forState:UIControlStateNormal]; button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0); [self.view addSubview:button]; NSLog(@"Home-Button line 645"); This button should link to my main ViewController in the Storyboard. The view has the identifier HauptMenu. I got no error, but the view doesnt change to my main ViewController. What is wrong? - (IBAction)home:(id)sender { NSLog(@"Button was tapped"); ViewController *viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"HauptMenu"]; NSLog(@"1"); [viewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal]; NSLog(@"2"); [self.navigationController pushViewController:viewController animated:NO]; [viewController release]; NSLog(@"3"); }

    Read the article

  • Restore and preserve UIViewController pushed from UINavigationController, no storyboard

    - by user2908112
    I try to restore a simple UIViewController that I pushed from my initial view controller. The first one is preserved, but the second one just disappear when relaunched. I don't use storyboard. I implement the protocol in every view controller and add the restorationIdentifier and restorationClass to each one of them. The second viewController inherit from a third viewController and is initialized from a xib file. I'm not sure if I need to implement the UIViewControllerRestoration to this third since I don't use it directly. My code looks like typically like this: - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization self.restorationIdentifier = @"EditNotificationViewController"; self.restorationClass = [self class]; } return self; } -(void)encodeRestorableStateWithCoder:(NSCoder *)coder { } -(void)decodeRestorableStateWithCoder:(NSCoder *)coder { } +(UIViewController *)viewControllerWithRestorationIdentifierPath:(NSArray *)identifierComponents coder:(NSCoder *)coder { EditNotificationViewController* envc = [[EditNotificationViewController alloc] initWithNibName:@"SearchFormViewController" bundle:nil]; return envc; } Should perhaps the navigationController be subclassed so it too can inherit from UIViewControllerRestoration?

    Read the article

  • How to call a method from another class that's been instantiated within the current class

    - by Pavan
    my screen has a few views like such __________________ | _____ | | | | | //viewX is a video screen | | | | | viewX | vY | | //viewY is a custom uiview i created. | |____| | //it contains a method which i would like to call that toggles |_________________| //the hidden property of this view. and when it hides, a little | | //button is replaced no the top right corner on top of viewX | viewZ | //the video layer | | |_________________| //viewZ is a view containing many square views - thumbnails. my question is, i dont know how to register for touch events so that it recognises any touch event on no matter which view the user touches the screen.. atm im handling the touch events for each view inside it. so all works well... however what im trying to do is that when the user taps anywhere else on the screen but on viewY, viewY should dissapear by calling that method in the viewY class. this viewY class is instantiated and has no xib file attached to it. the uiview is created progammatically in the viewY class. this whole class for viewY behviour is instantiated in viewX - the video view. my boss says add delegates.. although i have now clue how to do that... any help? is there anyway i can just make it really simple and be able to say REMOVE VIEW no matter which class im calling from? Also ive seen other people achieve this by using these funky arrows - ... <- etc.. although im not sure if thats what i need or how to implement such a thing. ah i think ive made my question quite complicated but i really mean it to be a simple one, and know it can be done in an easy way!

    Read the article

  • How combine TabBar + Navigation with XCode

    - by mamcx
    I'm triying to combine a TabBar + Navigation app. I have 5 tab bars, 4 are listing of stuff and drill down to details views. I try to follow this tutorial: http://www.iphonedevforums.com/forum/iphone-sdk-development/124-view-controller-problem.html But always get a blank view. This is what I do, with a clean project: I start with a TabBar template app. I put 5 tab bar buttons. I create a controller like: @interface FirstViewController : UINavigationController { } I put the main window.xib on tree mode & change the selected first view to FirstViewController I select the TabBar Controller in Interface builder, go to TabBar Attributes & change the class to navigation controler. Select the fist view & put the nib name "SecondView" In response, I get a blank screen. I must add that I wanna navigate from the details views, no from the main windows. i.e in the main window tab bar 1 is the list of people. I select a person then wanna navigate to the detail window.

    Read the article

  • Help adding a backgroundView to UITableViewCell

    - by Alex
    I'm getting really desperate trying to add a UIImageView to UITableViewCell.backgroundView. All my efforts have resulted in this crappy rendering: It looks like the cell's label's white background is sitting on top of cell's background and covering portions of it. I tried setting the label's background color to clear, or some other color and it does not have any event. It is always white. The reason I know it's the text label's background causing this white area is that if I don't do [cell setText:@"Cell text here"]; the white area is gone and I see just the cell's background image. Here's the code that I'm using. The table view is added in the .xib file and UITableView is added to UIViewController: - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [myCollection.items count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger rowIndex = indexPath.row; static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"darkCellBackground.png"]]; cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"darkCellBackground.png"]]; } [cell setText:@"Cell text here"]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic may go here. Create and push another view controller. // AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil]; // [self.navigationController pushViewController:anotherViewController]; // [anotherViewController release]; [tableView deselectRowAtIndexPath:indexPath animated:YES]; } - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { return NO; } I'm sure I'm doing something wrong but cant quite figure out what.

    Read the article

  • Getting a particular menu item from MainMenu

    - by Garry
    I have a nib (winA.xib) that contains a window. My app delegate contains an NSWindowController subclass called WinAController. WinAController has a property (NSMenu *mainMenu) that I want to point to the MainMenu. I have set it after I instantiate WinAController with this code: WinAController = [[WinAController alloc] initWithWindowNibName:@"WinA"]; WinAController.mainMenu = [NSApp mainMenu]; I have a menu item underneath the "Window" top-level menu item on MainMenu that invokes the [WinAController showWindow] method and displays WinA. I want to toggle the on/off state of this menu item depending on whether WinA is visible or not. WinAController also has another property (NSMenuItem *myMenuItem). How can I get a reference to a sub menu of the "Window" top-level menu item. The title of sub menu item I want to get is "Command". I have tried this: if (mainMenu != nil) { myMenuItem = [mainMenu itemAtIndex:[mainMenu indexOfItemWithTitle:@"Command"]]; } But it doesn't seem to work. Where am I going wrong? Thanks,

    Read the article

  • TabBar Support of Three20 iPhone Photo Gallery

    - by dooonot
    Hi all, I wend through this tutorial and created a photo gallery for the iPhone. Now I want to add it to my TabBar project. I already heard, that Three20 doesn't support XIB, so I changed my whole tab bar setup to programmatically. I think I am not too far from a final solution. I was able to get the photo gallery working in one tab but without functions (click on a pic -- it opens, etc). There is no navigation on top of the page that leads you to the detail image page. I faced this when I removed this from didFinishLaunchingWithOptions-method in app delegate: // Override point for customization after application launch TTNavigator* navigator = [TTNavigator navigator]; TTURLMap* map = navigator.URLMap; [map from:@"demo://album" toViewController: [AlbumController class]]; [navigator openURLAction:[TTURLAction actionWithURLPath:@"demo://album"]]; return YES; I had to remove it because otherwise the whole tab bar is not shown. The photo gallery uses the whole screen. I am not sure if it is just not shown, or not loaded. I also tried: tabbar.hidesBottomBarWhenPushed = NO; But that did not work at all. I tried to add the TTNavigator-code to loadView(), viewDidLoad() and init() in the AlbumController itself without a result. Does anyone know where I have to put this in order to get it working? Thanks guys, Cheers, dooonot

    Read the article

  • Sheet and thread memory problem

    - by Xident
    Hi Guys, recently I started a project which can export some precalculated Grafix/Audio to files, for after processing. All I was doing is to put a new Window (with progressindicator and an Abort Button) in my main xib and opened it using the following code: [NSApp beginSheet: REC_Sheet modalForWindow: MOTHER_WINDOW modalDelegate: self didEndSelector: nil contextInfo: nil]; NSModalSession session=[NSApp beginModalSessionForWindow:REC_Sheet]; RECISNOTDONE=YES; while (RECISNOTDONE) { if ([NSApp runModalSession:session]!=NSRunContinuesResponse) break; usleep(100); } [NSApp endModalSession:session]; A Background Thread (pthread) was started earlier, to actually perform the work and save all the targas/wave file. Which worked great, but after an amount of time, it turned out that the main thread was not responding anymore and my memory footprint raised unstoppable. I tried to debug it with Instruments, and saw a lot of CFHash etc stuff growing to infinity. By accident i clicked below the sheet, and temporary it helped, the main thread (AppKit ?) was releasing it's stuff, but just for a little time. I can't explain it to me, first of all I thought it was the access from my thread to the Progressbar to update the Progress (intervalled at 0,5sec), so I cut it out. But even if I'm not updating anything and did nothing with the Progressbar, my Application eat up all the Memory, because of not releasing it's "Main-Event" or whatsoever Stuff. Is there any possibility to "drain" this Main thread Memory stuff (Runloop / NSApp call?). And why the heck doesn't the Main thread respond anymore (after this simple task) ??? I don't have a clou anymore, please help ! Thanks in advance ! P.S. How do you guys implement "threaded long task" Stuff and updating your gui ???

    Read the article

  • Creating a OS X Cocoa App Web View in Xcode 5.0.1

    - by user1822824
    I created a HTML5 web app that I’m trying to wrap in a web view and submit to the Mac App Store. I’ve done the following: 1) Opened Xcode 5.0.1 and selected “Create a new Xcode project” 2) Under “OS X” I selected “Application” then I selected “Cocoa Application” then “Next” 3) I entered a “Product Name” and a “Company Identifier” then selected “Next” (I left all the other settings untouched) then “Create” 4) Under “General” “Deployment Info” “Deployment Target” I selected 10.6 — because I want the app to be compatible with all versions of OS X that support the Mac App Store 5) I clicked “MainMenu.xib” and selected “Window - My App” 6) From the “Object library” I drug the “Web View” object into my window and made it fill the window size 7) I saved my project and click the Play button in the upper left corner of Xcode The app tries to open but freezes. I don’t get an error in Xcode but it does open “main.m” and highlight “return NSApplicationMain(argc, argv);” in green and says “Thread 1: signal SIGABRT” I was hoping that someone could clarify why this isn’t working? And provide me with the last step to link the web view object? I searched Google and found tutorials for iOS and a few for OS X but for different versions of Xcode.

    Read the article

  • How to reset keyboard for an entry field?

    - by David.Chu.ca
    I am using tag field as a flag for text fields text view fields for auto-jumping to the next field: - (BOOL)findNextEntryFieldAsResponder:(UIControl *)field { BOOL retVal = NO; for (UIView* aView in mEntryFields) { if (aView.tag == (field.tag + 1)) { [aView becomeFirstResponder]; retVal = YES; break; } } return retVal; } It works fine in terms of auto-jumping to the next field when Next key is pressed. However, my case is that the keyboards are different some fields. For example, one fields is numeric & punctuation, and the next one is default (alphabetic keys). For the numeric & punctuation keyboard is OK, but the next field will stay as the same layout. It requires user to press 123 to go back ABC keyboard. I am not sure if there is any way to reset the keyboard for a field as its keyboard defined in xib? Not sure if there is any APIs available? I guess I have to do something is the following delegate? -(void)textFieldDidBegingEditing:(UITextField*) textField { // reset to the keyboard to request specific keyboard view? .... } OK. I found a solution close to my case by slatvik: -(void) textFieldDidBeginEditing:(UITextField*) textField { textField.keyboardType = UIKeybardTypeAlphabet; } However, in the case of the previous text fields is numeric, the keyboard stays numeric when auto-jumped to the next field. Is there any way to set keyboard to alphabet mode?

    Read the article

  • Switching between 2 UINavigationControllers

    - by Smikey
    Hi all, I seem to have a problem switching between 2 UINavigationControllers, i.e. one which controls the main (selection) menu of my application, and the second which controls the main session (i.e. the user can't go back to the selection menu once they're started a new session). The first works just fine, but I get into trouble when trying to load the second. I have a class called GameViewController which contains the second UINavigationController instance. I set this up as usual, linking it as an IBOutlet to the delegate and setting up the NavController in the GameViewController.xib file with its 'Class' property pointing at GameScreenViewController (my main game screen), and its NIB Name property pointing to the GameScreenViewController nib file. I then create a new instance of GameViewController and load it. In IB, the navigation controller looks fine, with its View 'loaded from "GameScreenViewController"', however when the NavigationController is loaded in the game, it actually loads the GameViewController's UIWindow instance (just a blank window). I'm not sure how to make it load the Navigation Controller's view rather than its own window? Also, another quick question. When I load the second navigation controller from the first, which makes more sense to use: [self.view addSubview:gameViewController.view]; or [self presentModalViewController:gameViewController animated:YES]; Thanks for any help, much appreciated :D Michael

    Read the article

  • How do I display core data on second view controller?

    - by jon
    I am working on my first core data iPhone application. I am using a navigation controller, and the root view controller displays 4 rows. Clicking the first row takes me to a second table view controller. However, when I click the back button, repeat the row tap, click the back button again, and tap the row a third time, I get an error. I have been researching this for a week with no success. I can reproduce the error easily: Create a new Navigation-based Application, use Core Data for storage, call it MyTest which creates MyTestAppDelegate and RootViewController. Add new UIViewController subclass, with UITableViewController and xib, call it ListViewController. Copy code from RootViewController.h and .m to ListViewController.h and .m., changing the file names appropriately. To simplify the code, I removed the trailing “_” from all variables. In RootViewController, I added #import ListViewController.h, set up an array to display 4 rows and navigate to ListViewController when clicking the first row. In ListViewController.m, I added #import MyTestAppDelegate.h” and the following code: - (void)viewDidLoad { [super viewDidLoad]; if (managedObjectContext == nil) { managedObjectContext = [(MyTestAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext]; } .. } The sequence that causes the error is tap row, return, tap row, return, tap row - error. managedObjectContext is synthesized for the third time. I appreciate your patience and your help, as this makes no sense to me. ADDENDUM: I may have a partial solution. http://www.iphonedevsdk.com/forum/iphone-sdk-development/41688-accessing-app-delegates-managed-object-context.html If I do not release the managedObjectContext in the .m file, the error goes away. Is that ok or will that cause me issues? - (void)dealloc { [fetchedResultsController release]; // [managedObjectContext release]; [super dealloc]; } ADDENDUM 2: See solution below. Sorry for the formatting issues - this was my first post.

    Read the article

  • How i pass my view to nib at run time(Dynamically) in viewController class?

    - by Rajendra Bhole
    Hi, I want to create viewController class programmatically in which the view of nib file of viewController is not fixed. I have a UntitledViewController class that contains 4 UIButtons: -(IBAction)buttonPressed:(id)sender{ if((UIButton *)sender == button1){ tagNumber = button1.tag; NewViewController *newVC = [[NewViewController alloc] init]; //newVC.tagN [self.navigationController pushViewController:newVC animated:YES]; NSLog(@"Button Tag Number:- %i", tagNumber); } if((UIButton *) sender == button2){ tagNumber = button2.tag; NewViewController *newVC = [[NewViewController alloc] init]; [self.navigationController pushViewController:newVC animated:YES]; } if((UIButton *) sender == button3){ tagNumber = button3.tag; NewViewController *newVC = [[NewViewController alloc] init]; [self.navigationController pushViewController:newVC animated:YES]; } if((UIButton *) sender == button4){ int x = tagNumber; tagNumber = button4.tag; NewViewController *newVC = [[NewViewController alloc] init]; newVC.untitledVC = self; [self.navigationController pushViewController:newVC animated:YES]; } } When I will click any one of the UIButtons, I want to create a new NewViewController class with button tag property but without fixed nib file. In NewViewController's loadView event I want to fix the view of the nib of NewViewController class using UIButton's tag property (In NewViewController.xib I'm creating 4 UIViews named view1, view2, view3 and view4). -(void)loadView{ [super loadView]; CGRect frame = CGRectMake(0, 0, 320, 480); UIView *newView = [[UIView alloc] initWithFrame:frame]; newView.tag = untitledVC.tagNumber; self.view1 = newView; } Now I want that when I click button1 the NewViewController will be generated with view1 and when I click button2 the NewViewController will be generated with view2 and so on with different implementation. Thanks.

    Read the article

  • iPhone loading view from nib only works once

    - by The Swissdude
    Hi Forum I'm trying to add a «loader-view» to my app which shows a spinner while doing stuff. This works fine the first time, but it doesn't work a second time. here's what I do: I have a viewController for the spinner (spinnerViewController) and a nib-file which I made in IB (spinner.xib). I load the nib in the viewDidLoad-event: spinnerView = [[spinnerViewController alloc] initWithNibName:@"spinner" bundle:nil]; [spinnerView retain]; spinnerView is declared in the .h-file (spinnerViewController *spinnerView;) next, I show the spinner-view: [self.view addSubview:spinnerView.view]; [self.view bringSubviewToFront:spinnerView.view]; which works fine... And now the trouble starts. No matter what I do, I can't show the spinner view again. I tried just hiding it (self.view sendSubViewToBack: spinnerView.view) which works for hiding, but when I try to bring it to the front again (self.view bringSubViewToFront: spinnerView.view) it doesn't work. I also tried removing the spinner-view and add it again with no success (within the spinnerViewController: [self.view removeFromSuperview] and to show it again [self.view addSubview... ) Any ideas what I'm doing wrong??? ;) Thanks for the help!

    Read the article

  • Button not moving on my interface

    - by user1500134
    First before I say anything I want to announce that i'm fairly new to this kind of stuff so don't get all super techie on me :D ! Ok so i'm making an app and i'm trying to get a button to move to certain coordinates depending on the screen size of the phone (4, 4S, 5, etc...). I have correct syntax but the button will not move at all. Here is the part of my .m ViewController file... - (void)viewDidLoad { if([[UIScreen mainScreen] respondsToSelector:NSSelectorFromString(@"scale")]) { if ([[UIScreen mainScreen] scale] < 1.1) { CGRect frame = done.frame; frame.origin.x = 129; //New x coordinate frame.origin.y = 401; //New y coordinate done.frame = frame; NSLog(@"Standard Resolution"); } if ([[UIScreen mainScreen] scale] > 1.9) { NSLog(@"High Defenition Resolution"); } } [super viewDidLoad]; // Do any additional setup after loading the view from its nib. } The NSLog is triggering int he console saying 'Standard Resolution'but the button doesn't move from where I placed it in the XIB file. This may be a small stupid mistake but hopefully you can help me anyways... Thanks guys! :) P.S. Yes I did link my IBOutlet to the button

    Read the article

  • How can I create dynamically updated views in a tab bar view, based on settings selection?

    - by Diggers
    Hi all, Noob question.... I've created a Tab Bar application. It has four tabs and works fine. Each view is created with a XIB and is effectively static. Each view takes user input and responds on screen. What I need to be able to do is change the input options the user have - in effect remove some UITextFields dependant upon which option the user selects in settings. I've created root.plist and created settings no problem i've also created additional XIBS for the altered UI, but what I don't know how to do, is call these into the tab view controller on demand. Effectively tab one has 3 possible views, tab two 3 possible views etc. But I only want the one that's relevant for the users settings selction to be displayed? Make sense? For reference, if we call the different views - UIInputViewA1, ...A2,....A3 UIInputViewB1,....B2....B3 etc. Hope someone can help, been trawling the net for nights trying to get my head round this. Beggining iPhone Development Bible doesn't help either. If you need any more info, please shout. Cheers Paul.

    Read the article

  • UIWebView leak? Can someone confirm?

    - by Shaggy Frog
    I was leak-testing my current project and I'm stumped. I've been browsing like crazy and tried everything except chicken sacrifice. I just created a tiny toy project app from scratch and I can duplicate the leak in there. So either UIWebView has a leak or I'm doing something really silly. Essentially, it boils down to a loadRequest: call to a UIWebView object, given an URLRequest built from an NSURL which references a file URL, for a file in the app bundle, which lives inside a folder that Xcode is including by reference. Phew. The leak is intermittent but still happens ~75% of the time (in about 20 tests it happened about 15 times). It only happens on the device -- this does not leak in the simulator. I am testing targeting both iPhone OS 3.1.2 and 3.1.3, on an original (1st Gen) iPod Touch that is using iPhone OS 3.1.3. To reproduce, just create a project from scratch. Add a UIWebView to the RootViewController's .xib, hook it up via IBOutlet. In the Finder, create a folder named "html" inside your project's folder. Inside that folder, create a file named "dummy.html" that has the word "Test" in it. (Does not need to be valid HTML.) Then add the html folder to your project in Xcode by choosing "Create Folder References for any added folders" Add the following to viewDidLoad NSString* resourcePath = [[NSBundle mainBundle] resourcePath]; NSString* filePath = [[resourcePath stringByAppendingPathComponent:@"html"] stringByAppendingPathComponent:@"dummy.html"]; NSURL* url = [[NSURL alloc] initFileURLWithPath:filePath]; NSURLRequest* request = [NSURLRequest requestWithURL:url]; // <-- this creates the leak! [browserView loadRequest:request]; [url release]; I've tried everything from setting delegate for the UIWebView and implementing UIWebViewDelegate, to not setting a delegate in IB, to not setting a delegate in IB and explicitly setting the web view's delegate property to nil, to using alloc/init instead of getting autoreleased NSURLRequests (and/or NSURLs)... I tried the answer to a similar question (setting the shared URL cache to empty) and that did not help. Can anyone help?

    Read the article

  • UIViewController not oreintating. Methods not called

    - by capple
    Greetings, This question does seem to be an ongoing saga in the world of iphone SDK... so heres my contribution... Had two separate projects from the same template... one semi-works, the other not at all... Please let me explain my steps... used this basic GL ES template //iphonedevelopment.blogspot.com/2008/12/opengl-project-template-for-xcode.html had to sort out some of the 'Release' configuration but otherwises has eveything I need to add orientation to a GL ES project. One my first project, did my stuff, then added these methods.... -(BOOL)shouldAutoRotateToInterfaceOrientation ..... -(void)willRotateToInterfaceOrientation .... -(void)didRotateFromInterfaceOrientation .... -(void)willAnimateRotationToInterfaceOrientation .... And understand what they do (or are trying to do in my case), the (BOOL)should... gets called once when the view controller is created, and returns 'YES'. But after that none of the other methods are called! So I started from scratch with a blank template (GL ES one from above)...and added minimum to support auto rotation. But this time none of the methods get called! So I investigated .... //developer.apple.com/iphone/library/qa/qa2010/qa1688.html as it said, I added the GLViewController.view first, then added the GLview as subviews of the application delegate. Nothing! Then found this //www.iphonedevsdk.com/forum/iphone-sdk-development/44993-how-determine-ipad-launch-orientation.html which states to enable orientation notifications [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; and then subsequently disable them in the view controller... makes sense...did it, nothing... I think the notifications might be on by default though, since I didn't need to enable them in the first project, yet it still try to verify a orientation (i.e (BOOL)shouldAutoRotate... )... If any one could help me out it would be greatly appreciated as this issue is driving me insane. Thanks in advance. The code can be found here ... http://rapidshare.com/files/392053688/autoRotation.zip N.B These projects avoid nib/xib resources, would like to keep it that way if possible. P.S iPad device not out where I am so I cannot test on a device yet. Would be nice for it to work on the simulator.

    Read the article

  • Unbalanced calls to begin/end appearance transitions for <ViewController>,<Tab>

    - by onkar
    I am trying to implement Tabs into my secondView.On button touch(from ViewController.m) I am navigating to secondView(Tabs). In my Tabs.xib file I have added a TabBar at bottom and it is custom class of UITabBar. ViewController.m - (IBAction)touchedInside:(id)sender { NSLog(@"touhced up inside"); Tabs *temp = [[Tabs alloc]initWithNibName:@"Tabs" bundle:nil]; [self.navigationController pushViewController:temp animated:YES]; [self presentViewController:temp animated:YES completion:nil]; } Tabs.m - (void)viewDidLoad { [super viewDidLoad]; AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; UITabBarController *tabBarController = [[UITabBarController alloc]init]; /* Tab_1 *firstView = [[Tab_1 alloc] init]; UITabBarItem *item1 = [[UITabBarItem alloc]initWithTitle:@"First" image:nil tag:1]; [firstView setTabBarItem:item1]; NSLog(@"after first tab is added"); Tab_2 *secondView = [[Tab_2 alloc] init]; UITabBarItem *item2 = [[UITabBarItem alloc]initWithTitle:@"Sec" image:nil tag:1] ; [secondView setTabBarItem:item2]; NSLog(@"after second tab is added"); [tabBarController setViewControllers:[NSArray arrayWithObjects:firstView,secondView,nil] animated:NO]; NSLog(@"after tab is added"); [appDelegate.window addSubview:tabBarController.view]; NSLog(@"after view is added"); */ appDelegate.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. UIViewController *viewController1 = [[Tab_1 alloc] initWithNibName:@"Tab 1" bundle:nil]; UIViewController *viewController2 = [[Tab_2 alloc] initWithNibName:@"Tab 2" bundle:nil]; UIViewController *viewController3 = [[Tab_2 alloc] initWithNibName:@"Tab 1" bundle:nil]; tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, viewController3, nil]; appDelegate.window.rootViewController = self.tabBarController; [appDelegate.window makeKeyAndVisible]; Tabs *temp = [[Tabs alloc]initWithNibName:@"Tabs" bundle:nil]; [self.navigationController presentModalViewController:temp animated:NO]; } Errors Unbalanced calls to begin/end appearance transitions for <ViewController: 0x6833c80>. 2012-12-06 09:57:48.963 demoTabs[667:f803] Unbalanced calls to begin/end appearance transitions for <Tabs: 0x6a3fc90>.

    Read the article

  • Hide button on first of two UIViews, but have it visible on second...

    - by Scott
    So I have a UIViewController (main application controller is a TabBarController). On this there is a UINavigationBar, and a UIBarButtonItem. I'm PRETTY sure I hooked up everything correctly in the Interface Builder and that the outlet in the code is connected to the button in the .xib. It should be because the method works correctly. Now I have another button on this view that brings up a second view, a UIWebView. I want this UIBarButtonItem, labeled "Back", to make the UIWebView dissapear, and bring back the first UIView, which it DOES DO correctly. However, when you are on the first UIView, there is no need to see the UIBarButtonItem, so how can I hide it but then bring it up for the UIWebView. By the way, both views use the same UINavigationBar, the UIWebView is brought up inside the tab bar and the nav bar. Here is my code: #import "WebViewController.h" @implementation WebViewController @synthesize webButton; @synthesize item; @synthesize infoView; UIWebView *webView; + (UIColor*)myColor1 { return [UIColor colorWithRed:0.0f/255.0f green:76.0f/255.0f blue:29.0f/255.0f alpha:1.0f]; } // Creates Nav Bar with default Green at top of screen with given String as title + (UINavigationBar*)myNavBar1: (NSString*)input { UIView *test = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0, 0.0, test.bounds.size.width, 45)]; navBar.tintColor = [WebViewController myColor1]; UINavigationItem *navItem; navItem = [UINavigationItem alloc]; navItem.title = input; [navBar pushNavigationItem:navItem animated:false]; return navBar; } - (IBAction) pushWebButton { self.navigationItem.rightBarButtonItem = item; CGRect webFrame = CGRectMake(0.0, 45.0, 320.0, 365.0); webView = [[UIWebView alloc] initWithFrame:webFrame]; [webView setBackgroundColor:[UIColor whiteColor]]; NSString *urlAddress = @"http://www.independencenavigator.com"; NSURL *url = [NSURL URLWithString:urlAddress]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; webView.scalesPageToFit = YES; [webView loadRequest:requestObj]; [self.view addSubview:webView]; [webView release]; } - (void) pushBackButton { [webView removeFromSuperview]; } // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { self.navigationItem.rightBarButtonItem = nil; [super viewDidLoad]; } @end Anyone know?

    Read the article

  • Gap appears between navigation bar and view after rotating & tab switching

    - by Bogatyr
    My iphone application is showing strange behavior when rotating: a gap appears between the navigation title and content view inside a tab bar view (details on how to reproduce are below). I've created a tiny test case that exhibits the same problem: a custom root UIViewController, which creates and displays a UITabBarController programmatically, which has two tabs: 1) plain UIViewController, and 2) UINavigationController created programmatically with a single plain UIViewController content view. The complete code for the application is in the root controller's viewDidLoad (every "*VC" class is a totally vanilla UIViewController subclass with XIB for user interface from XCode, with only the view background color changed to clearly identify each view, nothing else). Here's the viewDidLoad code, and the shouldAutorotateToInterfaceOrientation code, this code is the entire application basically: - (void)viewDidLoad { [super viewDidLoad]; FirstVC *fvc = [[FirstVC alloc] initWithNibName:@"FirstVC" bundle:nil]; NavContentsVC *ncvc = [[NavContentsVC alloc] initWithNibName:@"NavContentsVC" bundle:nil]; UINavigationController *svc = [[UINavigationController alloc] initWithRootViewController:ncvc]; NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:2]; [localControllersArray addObject:fvc]; [localControllersArray addObject:svc]; fvc.title = @"FirstVC-Title"; ncvc.title = @"NavContents-Title"; UITabBarController *tbc = [[UITabBarController alloc] init]; tbc.view.frame = CGRectMake(0, 0, 320, 460); [tbc setViewControllers:localControllersArray]; [self.view addSubview:tbc.view]; [localControllersArray release]; [ncvc release]; [svc release]; [fvc release]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } Here's how to reproduce the problem: 1) start application 2) rotate device (happens in simulator, too) to landscape (UITabBar properly rotates) 3) click on tab 2 4) rotate device to portrait -- notice gap of root view controller's background color of about 10 pixels high beneath the Navigation title bar and the Navigation content view. 5) click tab 1 6) click tab 2 And the gap is gone! From my real application, I see that the gap remains during all VC push and pops while the NavigationController tab is active. Switching away to a different tab and back to the Nav tab clears up the gap. What am I doing wrong? I'm running on SDK 3.1.3, this happens both on the simulator and on the device. Except for this particular sequence, everything seems to work fine. Help!

    Read the article

  • Programatically created UITableViewCell subclass only working on highlight

    - by squarefrog
    I've created a subclass of UITableViewCell but I'm struggling to get it to work properly. If I use UITableViewStyleDefault then the class only works when highlighted. If I use UITableViewStyleValue1 then it mostly works but I'm unable to change label fonts much. I tried researching but it seems everyone is doing this via a .xib file, but not programatically. Implementation file #import "ASCustomCellWithCount.h" @implementation ASCustomCellWithCount @synthesize primaryLabel,secondaryLabel,contentCountImage,contentCount; - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // Initialization code contentCountImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed: @"tableCount.png"] ]; primaryLabel = [[UILabel alloc] init]; primaryLabel.textAlignment = UITextAlignmentLeft; primaryLabel.textColor = [UIColor blackColor]; primaryLabel.font = [UIFont systemFontOfSize: 20]; primaryLabel.backgroundColor = [UIColor clearColor]; secondaryLabel = [[UILabel alloc] init]; secondaryLabel.textAlignment = UITextAlignmentLeft; secondaryLabel.textColor = [UIColor blackColor]; secondaryLabel.font = [UIFont systemFontOfSize: 8]; secondaryLabel.backgroundColor = [UIColor clearColor]; contentCount = [[UILabel alloc] init]; contentCount.textAlignment = UITextAlignmentCenter; contentCount.font = [UIFont boldSystemFontOfSize: 15]; contentCount.textColor = [UIColor whiteColor]; contentCount.shadowColor = [UIColor blackColor]; contentCount.shadowOffset = CGSizeMake(1, 1); contentCount.backgroundColor = [UIColor clearColor]; [self.contentView addSubview: contentCountImage]; [self.contentView addSubview: primaryLabel]; [self.contentView addSubview: secondaryLabel]; [self.contentView addSubview: contentCount]; } return self; } - (void)layoutSubviews { [super layoutSubviews]; CGRect contentRect = self.contentView.bounds; // CGFloat boundsX = contentRect.origin.x; primaryLabel.frame = CGRectMake(0 ,0, 200, 25); secondaryLabel.frame = CGRectMake(0, 30, 100, 15); contentCount.frame = CGRectMake(contentRect.size.width - 48, contentRect.size.height / 2 - 13, 36, 24); contentCountImage.frame = CGRectMake(contentRect.size.width - 48, contentRect.size.height / 2 - 12, 36, 24); } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } - (void)dealloc { [primaryLabel release]; [secondaryLabel release]; [contentCountImage release]; [contentCount release]; } @end And then to create the cell I use - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; ASCustomCellWithCount *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[ASCustomCellWithCount alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } cell.textLabel.text = [NSString stringWithFormat:@"%@", [tempArray objectAtIndex: indexPath.row]]; cell.contentCount.text = @"49"; return cell; }

    Read the article

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