Search Results

Search found 81 results on 4 pages for 'viewdidappear'.

Page 1/4 | 1 2 3 4  | Next Page >

  • viewDidAppear called when popping navigationController

    - by Tiago
    I'm having a bit of a problem with the viewDidAppear: method. I have a tabBarController with navigationControllers on each tab, and I have an action that requires that all the navigation controllers pop to their rootViewControllers (programmatically). The problem is that when they pop each navigation controller, the rootViewController's viewDidAppear get's called without it actually being shown. This causes them to do some stuff they were not supposed to (like showing alerts) unless they are actually shown. Besides having to check the currently selected tabBar item, is there any other way to solve this? Thanks.

    Read the article

  • the callback sequence of viewDidAppear and viewDidDisappear between two view controllers

    - by olinYY
    As I know, there are at least two ways to present a UIViewController on another UIViewController, first is using presentModalViewController:animated: on UIViewController, another is using pushViewController:animated: on UINavigationController, it seems when 2 view controller changing their appearance, the invoke sequence of appear/disappear callbacks are different. Following is an example, A is a UINavigationController, and B is a normal view controller, the actual callback sequence are: (1) A using presentModalViewController:animated: to show B: [B viewWillAppear]; [A viewWillDisappear]; [B viewDidAppear]; [A viewDidDisappear]; (2) A using pushViewController:animated: to show B: [A viewWillDisappear]; [B viewWillAppear]; [A viewDidDisappear]; [B viewDidAppear]; So my question is that, are these different callback sequence stable, or there are no definite sequence we can rely on? If they are stable, is there any document mentions this behavior? Can anyone help? Thanks in advanced!

    Read the article

  • Activity Indicator display in Table View whilst row data is being fetched

    - by Tofrizer
    Hi All, I am navigating from tableview1.row to a tableview2 which has a LOT of rows being fetched. Given the load time is around 3 seconds, I want the navigation to slide into tableview2 as soon as the tableview1.row is selected, and then display a UIActivityIndicatorView above tableview2 whilst the data is fetched and then rendered in its underlying table view. Note, tableview2 is actually a subview of the parent UIView (as opposed to the parent being a UITableView). I've seen this post: http://stackoverflow.com/questions/2153653/activity-indicator-shold-be-displayed-when-navigating-from-uitableview1-to-uitabl ... which gives instructions to add the activity indicator start and stopAnimating calls around the data fetch into viewDidLoad of tableview2. Thing is, I'm not sure how the above solution could work as viewDidLoad runs and completes before tableview2 visibly slides into view. Separately, I also tried adding an activity indicator over tableview2 in IB and added the IBOutlet indicator's start/stop animating code into viewDidAppear. What happens is the data fetch runs and I can see the indicator spinning but at the end of the fetch, the table view is empty. Seems like viewDidAppear is too late to add data to the table view as cellForRowAtIndexPath etc has already fired. Can anyone please suggest any pointers? I could very well be missing something obvious here (its nearly 5am where I am and think my brain is mush). Should I re-trigger cellForRowAtIndexPath etc from viewDidAppear? Is the issue that my table view is a subview and not the parent view? Thanks

    Read the article

  • with "viewDidLoad" my viewController take much time to appear!

    - by dingua
    hi, when i load my viewController i used "viewDidLoad"method to init my view ,but this take much time to make the view appeared .So i had the idea to use "viewDidAppear" method to accelerate the appearance of my view but the load of the informations about my view are now loaded to the memory every time that i push my view (which is normal) or i pop to it(and there is my problem) Have you an idea?

    Read the article

  • iPhone crashing when presenting modal view controller

    - by Michael Waterfall
    Hi there, I'm trying to display a modal view straight after another view has been presented modally (the second is a loading view that appears). - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; // Show load LoadViewController *loader = [[LoadViewController alloc] init]; [self presentModalViewController: loader animated:NO]; [loader release]; } But when I do this I get a "Program received signal: "EXC_BAD_ACCESS"." error. The stack trace is: 0 0x30b43234 in -[UIWindowController transitionViewDidComplete:fromView:toView:] 1 0x3095828e in -[UITransitionView notifyDidCompleteTransition:] 2 0x3091af0d in -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] 3 0x3091ad7c in -[UIViewAnimationState animationDidStop:finished:] 4 0x0051e331 in run_animation_callbacks 5 0x0051e109 in CA::timer_callback 6 0x302454a0 in CFRunLoopRunSpecific 7 0x30244628 in CFRunLoopRunInMode 8 0x32044c31 in GSEventRunModal 9 0x32044cf6 in GSEventRun 10 0x309021ee in UIApplicationMain 11 0x00002154 in main at main.m:14 Any ideas? I'm totally stumped! The loading view is empty so there's definitely nothing going on in there that's causing the error. Is it something to do with launching 2 views modally in the same event loop or something? Thanks, Mike Edit: Very strange... I have modified it slightly so that the loading view is shown after a tiny delay, and this works fine! So it appears to be something within the same event loop! - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; // Show load [self performSelector:@selector(doit) withObject:nil afterDelay:0.1]; } - (void)doit { [self presentModalViewController:loader animated:YES]; }

    Read the article

  • iPhone crashing when presenting modal view controller

    - by Michael Waterfall
    I'm trying to display a modal view straight after another view has been presented modally (the second is a loading view that appears). - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; // Show load LoadViewController *loader = [[LoadViewController alloc] init]; [self presentModalViewController: loader animated:NO]; [loader release]; } But when I do this I get a "Program received signal: "EXC_BAD_ACCESS"." error. The stack trace is: 0 0x30b43234 in -[UIWindowController transitionViewDidComplete:fromView:toView:] 1 0x3095828e in -[UITransitionView notifyDidCompleteTransition:] 2 0x3091af0d in -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] 3 0x3091ad7c in -[UIViewAnimationState animationDidStop:finished:] 4 0x0051e331 in run_animation_callbacks 5 0x0051e109 in CA::timer_callback 6 0x302454a0 in CFRunLoopRunSpecific 7 0x30244628 in CFRunLoopRunInMode 8 0x32044c31 in GSEventRunModal 9 0x32044cf6 in GSEventRun 10 0x309021ee in UIApplicationMain 11 0x00002154 in main at main.m:14 Any ideas? I'm totally stumped! The loading view is empty so there's definitely nothing going on in there that's causing the error. Is it something to do with launching 2 views modally in the same event loop or something? Thanks, Mike Edit: Very strange... I have modified it slightly so that the loading view is shown after a tiny delay, and this works fine! So it appears to be something within the same event loop! - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; // Show load [self performSelector:@selector(doit) withObject:nil afterDelay:0.1]; } - (void)doit { [self presentModalViewController:loader animated:YES]; }

    Read the article

  • How to create a view controller that supports both landscape and portrait, but does not rotate between them (keeps its initial orientation)

    - by Joshua J. McKinnon
    I want to create a view controller that supports both landscape and portrait orientations, but that can not rotate between them - that is, the view should retain its original orientation. I have tried creating an ivar initialOrientation and setting it in -viewDidAppear with initialOrientation = self.interfaceOrientation; then - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == initialOrientation); } But that causes confusing problems (presumably because -shouldAutorotateToInterfaceOrientation is called before -viewDidAppear). How can I lock the orientation to its original orientation?

    Read the article

  • Black Corners On Grouped UITableViewCells Only After Navigation Pops

    - by coneybeare
    I am not graphics expert but I somehow managed to make some good looking custom grouped UITableViewCells by setting the background view to a backgroundView with some CG code. In all SDK's up to 3.1.3 (maybe 3.2... I haven't tested on the iPad) this was working great, but I think a more recent SDK has introduced a change in the way graphics are cached offscreen. Upon first render, everything is great: The drawing is fine and the corners are transparent. If I push a couple of view controllers on the navigation stack and come back, there are now black corners that appear in the views: BEFORE && AFTER I have tons of code, most of which is written up here. I have tried tweaking to the best of my ability, looking at the docs for applicable changes, but after at least 8 hours in I still cannot find what might cause this. I have tried setting every view I can think of to be backgroundColor=clearColor and opaque=NO What else am I missing? Any debugging tips? UPDATE: I have some debug code in viewDidAppear that prints the backgroundColor and class description of all the subviews. - (void)debugView:(UIView *)view { DebugLog(@"%@ - %@", view.backgroundColor, [[view class] description]); for (UIView* child in view.subviews) { [self debugView:child]; } } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [DownloadController.networkQueue setSuspended:NO]; for (TTTableViewCell *cell in [self.tableView visibleCells]) { [cell debugView:cell]; } } With this code, I inspect the backgroundColor settings of the cell views on first load, when it is fine, and then again after coming back. There are some differences, but all the colors are still set to be clear. This leads me to believe the issue is underneath the UITableViewCell. UPDATE 2: I have created a simple sample application to highlight the problem here

    Read the article

  • Get notified when UITableView has finished asking for data?

    - by kennethmac2000
    Hi everyone, Is there some way to find out when a UITableView has finished asking for data from its data source? None of the viewDidLoad/viewWillAppear/viewDidAppear methods of the associated view controller (UITableViewController) are of use here, as they all fire too early. None of them (entirely understandably) guarantee that queries to the data source have finished for the time being (eg, until the view is scrolled). One workaround I have found is to call reloadData in viewDidAppear, since, when reloadData returns, the table view is guaranteed to have finished querying the data source as much as it needs to for the time being. However, this seems rather nasty, as I assume it is causing the data source to be asked for the same information twice (once automatically, and once because of the reloadData call) when it is first loaded. The reason I want to do this at all is that I want to preserve the scroll position of the UITableView - but right down to the pixel level, not just to the nearest row. When restoring the scroll position (using scrollRectToVisible:animated:), I need the table view to already have sufficient data in it, or else the scrollRectToVisible:animated: method call does nothing (which is what happens if you place the call on its own in any of viewDidLoad, viewWillAppear or viewDidAppear). Thanks in advance for your assistance!

    Read the article

  • BeginAnimations and CommitAnimations with NavigationController.PushViewController

    - by Chris S
    I'm trying to get a basic flip animation transition working when I push a controller inside a navigation. The code below flips the view, however the view appears first (each element fades in), and then the flip occurs. Is it possible to do a flip animation with a UINavigationController? Any pointers would be great, the examples I've found for Monotouch are performing animations on Views inside another view. void ToolbarButtonClick() { InformationController controller = new InformationController(); NavigationController.PushViewController(controller,true); } public class InformationController : UIViewController { public override void ViewDidLoad () { UIView.BeginAnimations("Flip"); UIView.SetAnimationDuration(1.0); UIView.SetAnimationTransition(UIViewAnimationTransition.FlipFromRight,View,true); base.ViewDidLoad (); Title = "Information"; } public override void ViewWillAppear (bool animated) { base.ViewWillAppear (animated); } public override void ViewDidAppear (bool animated) { base.ViewDidAppear (animated); UIView.CommitAnimations(); } }

    Read the article

  • Strategy to lazy load images for buttons within UIScrollView?

    - by greypoint
    I have a horizontal UIScrollView that contains UIButtons (though it could be any object). I would like to only download images for these buttons as the user scrolls and they are seen. I would also like an activityindicator running on each button while the images are downloading. Here's what I've tried with results: Check content offset of uiscrollview and download images for visible buttons. Problem: issues getting activity view shown within subclassed UIButton and not desired usability since images are only downloaded once scrolling stops. Add subviews (not buttons) to the UIScrollview hoping to use the view's ViewController to initiate a downloaded on viewDidAppear. Problem: viewDidAppear never seems to get called (because I am using addSubView?). I've seen other apps that do this kind of loading but need some guidance on the typical set-up. Ebay's app is a great example. All items have a default image until the item comes into view, then an activityindicator runs and the items unique image is downloaded. Thanks for assistance.

    Read the article

  • Application crash when using an NSTimer and pushViewController

    - by Cesar
    I'm using an NSTimer to implement a 3 seconds splash screen. If a don't use a timer the view it's correctly pushed but if I use the timer for adding a little delay the application crash with a EXC_BAD_ACCESS. I'm pretty sure the answer contains "memory management" but I can't get the point... @interface RootViewController : UIViewController { NSTimer *timer; } -(void)changeView:(NSTimer*)theTimer; @property(nonatomic,retain) NSTimer *timer; ... @implementation RootViewController @synthesize timer; - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [[self navigationController] setNavigationBarHidden:YES]; timer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(changeView:) userInfo:nil repeats:NO]; } -(void)changeView:(NSTimer*)theTimer { NSLog(@"timer fired"); //Crash here, but only if called using a timer [[self navigationController] pushViewController:list animated:YES]; }

    Read the article

  • Including a NSUserDefault password test in 1st Tab.m to load a loginView gives eror?

    - by Michael Robinson
    I have a name and password in NSUserDefaults for login. I have this in my 1stTab View.m class to test for presence and load a login/signup loginView.xib modally if there is no password or name stored in the app. Here is the pulling of the defaults: -(void)refreshFields { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; usernameLabel.text = [defaults objectForKey:kUsernameKey]; passwordLabel.text = [defaults objectForKey:kPasswordKey]; { Here is the Test: - (void)viewDidAppear:(BOOL)animated { [self refreshFields]; [super viewDidAppear:animated]; if ([usernameLabel.text length] == 0 || [passwordLabel.text length] == 0) { LoginViewController * vc = [[[LoginViewController alloc] initWithNibName:@"LoginView" bundle:nil] autorelease]; [self presentModalViewController:vc animated: false]; } else { [[self tableView ]reloadData]; } } Thanks in advance, I'm getting this error in the console: * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key usernameLabel.'

    Read the article

  • Password test in 1st Tab.m to load a loginView gives class error?

    - by Michael Robinson
    I have a name and password in NSUserDefaults for login. I have this in my 1stTab View.m class to test for presence and load a login/signup loginView.xib modally if there is no password or name stored in the app. Here is the pulling of the defaults: -(void)refreshFields { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; usernameLabel.text = [defaults objectForKey:kUsernameKey]; passwordLabel.text = [defaults objectForKey:kPasswordKey]; { Here is the Test: - (void)viewDidAppear:(BOOL)animated { [self refreshFields]; [super viewDidAppear:animated]; if ([usernameLabel.text length] == 0 || [passwordLabel.text length] == 0) { LoginViewController * vc = [[[LoginViewController alloc] initWithNibName:@"LoginView" bundle:nil] autorelease]; [self presentModalViewController:vc animated: false]; } else { [[self tableView ]reloadData]; } } Thanks in advance, I'm getting this error in the console: * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key usernameLabel.'

    Read the article

  • Where is the best place to run initialization code for a UITabBarController?

    - by bobobobo
    I have a UITabBarController in my application. I have to perform some customization to the NIB file using code the first time a view embedded in that UITabBarController gets loaded. When applicationDidFinishLaunching occurs, the UITabBarController's views apparently are not loaded -- if I try to modify the view controllers inside a tab bar that the tab bar is to load in applicationDidFinishLaunching, then those changes are ignored. I'm assuming this is because the tab bar didn't finish loading yet. So, I need a good place to put code that will run immediately after a tabbar is fully ready -- i.e. after it has loaded all the views from their respective nib files. I'm finding the only place I can do this is to track the first time viewDidAppear on each individual view controller. Note I can't use viewWillAppear because I need the value of tabBarController.selectedIndex to be accurate, and it is only actually updated after viewDidAppear gets fired, not when viewWillAppear gets fired.

    Read the article

  • How to release a string created inside a method in iphone?

    - by Warrior
    I have declared a local string inside the method.I am releasing the string inside the same method.I found my code crashing if release that object.If i dont release the string,code runs successfully.I have called that method in viewdidappear so that method is called while pushing and poping.Nothing gets printed in the console. Here is my code -(void)appendString{ NSString *locStr = [[NSString alloc] initWithString:@""]; for (int i=0;i<[result count]; i++) { locStr=[locStr stringByAppendingFormat:@"%@",[result objectAtIndex:i]]; } [str setString:locStr]; [locStr release]; } I am calling the "appendString" method from "viewDidAppear"."str" is a NSMutable string declared in .h class.How should i release the "locStr" .Please help me out

    Read the article

  • Creating Drill-Down Detail UITableView from JSON NSDictionary

    - by Michael Robinson
    I'm have a load of trouble finding out how to do this, I want to show this in a UITableDetailView (Drill-Down style) with each item in a different cell. All of the things I've read all show how to load a single image on the detail instead of showing as a UITableView. Does the dictionary have to have "children" in order to load correctly? Here is the code for the first view creating *dict from the JSON rowsArray. I guess what I'm looking for is what to put in the FollowingDetailViewController.m to see the rest of *dict contents, so when selecting a row, it loads the rest of the *dict. I have rowsArray coming back as follows: '{ loginName = Johnson; memberid = 39; name = Kris; age = ;}, etc,etc... Thanks, // SET UP TABLE & CELLS - (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]; } NSDictionary *dict = [rowsArray objectAtIndex: indexPath.row]; cell.textLabel.text = [dict objectForKey:@"name"]; cell.detailTextLabel.text = [dict objectForKey:@"loginName"]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; return cell; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; - (void)viewDidLoad { [super viewDidLoad]; //GET JSON FROM WEBSERVICES: NSURL *url = [NSURL URLWithString:@"http://10.0.1.8/~imac/iphone/jsontest.php"]; NSString *jsonreturn = [[NSString alloc] initWithContentsOfURL:url]; NSData *jsonData = [jsonreturn dataUsingEncoding:NSUTF32BigEndianStringEncoding]; NSError *error = nil; NSDictionary * dict = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error]; if (dict) { rowsArray = [dict objectForKey:@"member"]; [rowsArray retain]; } [jsonreturn release]; } //GO TO DETAIL VIEW: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { FollowingDetailViewController *aFollowDetail = [[FollowingDetailViewController alloc] initWithNibName:@"FollowingDetailView" bundle:nil]; [self.navigationController pushViewController:aFollowDetail animated:YES]; }

    Read the article

  • How Can i reload data in tableview in view controller in iphone

    - by Pugal Devan
    Hi, I am new to iphone development. I have created 5 buttons in the view. On clicking the buttons it navigates to the corresponding views. On clicking the "News" button it navigates and displayed the parsing details in the table view.(This table view, I have created View controller and added table view using Interface Builder and i have set all the properties.) and i go to another button and comes back to the "News" button, every time parsing will happened.How to avoid the multiple parsing when i come back to the button. i have tried this one and my code is, - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; static int i; if(i == 0) { NSString * path = @"http://www.AAAAAAAAAAAAAAAA.com"; [self parseXMLFileAtURL:path]; i++; } [self.newsTable reloadData]; } } Now the parsing is happened only time but the datas are doesnt displayed. My problem is the tableview doesnot reload. newsTable is the instance of the Tableview. How can i achieve this. Please help me out. Thanks.

    Read the article

  • Nav Controller, UITableViewController, UITextField to become firstResponder?

    - by Daniel Granger
    I have a core data application which uses a navigation controller to drill down to a detail view and then if you edit one of the rows of data in the detail view you get taken to an Edit View for the that single line, like in Apples CoreDataBooks example! The edit view is a UITableviewController which creates its table with a single section single row and a UITextfield in the cell, programatically. What I want to happen is when you select a row to edit and the edit view is pushed onto the nav stack and the edit view is animated moving across the screen, I want the textfield to be selected as firstResponder so that the keyboard is already showing as the view moves across the screen to take position. Like in the Contacts app or in the CoreDataBooks App. I currently have the following code in my app which causes the view to load and then you see the keyboard appear (which isn't what I want, I want the keyboard to already be there) - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [theTextField becomeFirstResponder]; } You can't put this in -viewWillAppear as the textfield hasn't been created yet so theTextField is nil. In the CoreDataBooks App where they achieve what i want they load there tableview from a nib so they use the same code but in -viewWillAppear as the textfield has already been created! Is there anyway of getting around this without creating a nib, I want to keep the implementation programatic to enable greater flexibility. Many Thanks

    Read the article

  • Resize a UITableView to accomodate a translucent header before it becomes visible

    - by scotru
    I have a UITableView inside a UINavigationController. The navigation controller uses a translucent navigation bar--as a result, my table view is displayed behind the navigation bar and it's height includes the height of the navigation bar. However, I want the table view to appear below the navigation bar (as it would if it were not translucent). I'm working in MonoTouch, but I think the principles are language independent. Here's the code I'm using to resize the UITableView frame: RectangleF rect = tableView.Frame; tableView.Frame = new RectangleF (rect.Left, rect.Top + 44, rect.Width, rect.Height - 44); tableView.ContentInset = new UIEdgeInsets (0, 0, 0, 0); This works fine if I place it in the viewDidAppear method, but will not work in the viewWillAppear method. In the viewDidAppear method, however I can see the resize occurring briefly in the form of a flicker. I want to do the resize before the frame appears. But if I put this code in viewWillAppear or viewDidLoad, it has no effect. Thanks in advance for any help!

    Read the article

  • Verifying existence of name and password in NSUserDefaults to Skip a login/Screen

    - by Michael Robinson
    I have a Tabbar/Tableview App that modally loads a Login/Signup view when the app loads, I have set up a Root.plist in a settings bundle for the name and password and have successfully retrieved the items. I want to be able to do two things: 1) Do a test to see if the NSUserDefault Strings are empty and if so load the Login/Signup view. 2) If the strings are available then use the string contents to login to my Webservice. Thanks in advance. Here is my LoginViewController .m : @synthesize usernameField; @synthesize passwordField; @synthesize loginButton; @synthesize loginIndicator; @synthesize usernameLabel; @synthesize passwordLabel; -(void)refreshFields { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; usernameLabel.text = [defaults objectForKey:kUsernameKey]; passwordLabel.text = [defaults objectForKey:kPasswordKey]; } - (void)viewDidAppear:(BOOL)animated { [self refreshFields]; [super viewDidAppear:animated]; } - (void)viewDidLoad { [super viewDidLoad]; [self refreshFields]; [self.navigationController setNavigationBarHidden:YES animated:NO]; } - (IBAction) login: (id) sender { { NSString *post =[NSString stringWithFormat:@"username=%@&password=%@",usernameField.text, passwordField.text]; NSString *hostStr = @"http:~iphone_login.php?"; hostStr = [hostStr stringByAppendingString:post]; NSData *dataURL = [NSData dataWithContentsOfURL: [ NSURL URLWithString: hostStr ]]; NSString *serverOutput = [[NSString alloc] initWithData:dataURL encoding: NSASCIIStringEncoding]; NSLog(@"Site: %@",hostStr); NSLog(@"Site: %@",serverOutput); if([serverOutput isEqualToString:@"Yes"]){ UIAlertView *alertsuccess = [[UIAlertView alloc] initWithTitle:@"Congrats" message:@"You are authorized " delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; [alertsuccess show]; [alertsuccess release];

    Read the article

  • Can I use drawRect to refresh a UIView subclass?

    - by Timbo
    I've created a subclass of UIView called Status which is designed to display a rectangle of a certain size (within a view) depending on the value of a variable. // Interface #import <Foundation/Foundation.h> #import <QuartzCore/QuartzCore.h> @interface Status: UIView { NSString* name; int someVariable; } @property int someVariable; @property (assign) NSString *name; - (void) createStatus: (NSString*)withName; - (void) drawRect:(CGRect)rect; @end // Implementation #import "Status.h" @implementation Status @synthesize name, someVariable; - (void) createStatus: (NSString*)withName { name = withName; someVariable = 10000; } - (void) drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); //Draw Status CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1); // fill CGContextFillRect(context, CGRectMake(0.0, 0.0, someVariable, 40.0)); } //// myviewcontroller implementation - (void) viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; myStatus = [[Status alloc] initWithFrame:CGRectMake(8,8,200,56)]; myStatus.backgroundColor = [UIColor grayColor]; [self.view addSubview:myStatus]; } How do I set this up so I can repeatedly call a refresh of the status bar? I'll probably call the refresh 4 times per second using a NSTimer, I'm just not sure what to call or if I should move this rectangle drawing to a separate function or something... Thanks in advance for your help :)

    Read the article

  • IPhone - Memory Management problems.

    - by user321721
    i am going over my code and trying to get a handle on proper memory management. This code: imageView = [[[UIImageView alloc] initWithImage:myImage] autorelease]; causes my application to crash. I am using multiple view controllers within a nav bar controller. The app works fine, i cant select a person from the first view controller (tableview) and it puts me to a list of that persons photos, i can then select a photo from that view controller (tableview) and move to a final view with a scrollview for viewing the photo. Once i hit back on the navbar the previous view loads (list of photos in a tableview) however the app crashes right before the row is deselected using this code: (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; if(RowSelected != nil) { [MainTableView deselectRowAtIndexPath:RowSelected animated:YES]; } } Row selected is stored when a the user clicks a row. If i leave the code as : imageView = [[UIImageView alloc] initWithImage:myImage]; The app runs fine. Am i doing something wrong? do i not need to autorelease this? Thanks!

    Read the article

1 2 3 4  | Next Page >