Search Results

Search found 10 results on 1 pages for 'aahrens'.

Page 1/1 | 1 

  • Trouble refreshing UITableView

    - by aahrens
    I'm trying to develop a basic GPA Calculator. I have an AllCourses class that holds Course objects. I have an AllCourses object in my CalcAppDelegate. In my ThirdViewController I can successfully update the number of Courses in my AllCourses object. However, the problem I'm having is that when I switch to the RootViewController the UITable isn't being repopulated with the updated Courses that were added. I tried [self reloadData] in the viewWillAppear in my RootViewController but it caused my app to close. I didn't use IB to create the views so I think it could be the case that I don't have things hooked up correctly. I did it programatically. Does anyone see anything I'm missing in my code? Here is the link to my project http://files.me.com/aahrens/q0odzi

    Read the article

  • Hiding/ Showing UIPickerView

    - by aahrens
    I Have an a touchesEnded event that checks for when a UITextField is pressed. What I would like it to do is is hide/show a UIPickerView. How can this be done? - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [[event allTouches] anyObject]; if (CGRectContainsPoint([self.textField frame], [touch locationInView:self.view])) { NSString * error = @"Touched the TextField"; UIAlertView * errorAlert = [[UIAlertView alloc] initWithTitle:@"Selection!" message:error delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [errorAlert show]; //Want to show or hide UIPickerView } } I already have an allocated UIPickerView when touches occur @interface ThirdViewController : UIViewController <UITextFieldDelegate,UIPickerViewDelegate> { IBOutlet UIPickerView *pickerView; }

    Read the article

  • Setting an NSMutableArray in AppDelegate to be an NSMutableArray in

    - by aahrens
    What i'm trying to accomplish is to have an NSMutableArray defined in the AppDelegate. I then have two UIViewControllers. One view is responsible for displaying the array from the AppDelegate. The other view is used to add items to the array. So the array starts out to be empty. View1 doesn't display anything because the array is empty. The User goes to View2 and adds an item to the array in AppDelegate. Then when the user goes back to View1 it now displays one item. Here is how I'm trying to accomplish this @interface CalcAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; UITabBarController *tabBarController; NSMutableArray *globalClasses; } @property (nonatomic,retain) NSMutableArray *globalClasses; My other view In the viewDidload I set the array in my View to be the one in the AppDelegate. In an effort to retain values. allCourses = [[NSMutableArray alloc]init]; CalcAppDelegate *appDelegate = (CalcAppDelegate *)[[UIApplication sharedApplication] delegate]; allCourses = appDelegate.globalClasses; Then I would update my allCourses array by adding a new item. Then try to set the array in the AppDelegate to be equal to the modified one. CalcAppDelegate *appDel = (CalcAppDelegate *)[[UIApplication sharedApplication] delegate]; NSLog(@"Size before reset %d",[appDel.globalClasses count]); appDel.globalClasses = allCourses; NSLog(@"Size after reset %d",[appDel.globalClasses count]); What I'm seeing that's returned is 2 in the before, and 2 after. So it doesn't appear to be getting updated properly. Any suggestions?

    Read the article

  • Pass NSMutableArray between two UIViewController's

    - by aahrens
    I have two view controllers name RootViewController and SecondViewController. In the FirstViewController I have this NSMutableArray @interface RootViewController : UITableViewController { NSMutableArray *allClasses;}@property (nonatomic,retain) NSMutableArray *allClasses; In the RootViewController I populate the UITableView with all the objects within allClasses In my SecondViewController I have @interface SecondViewController : UIViewController <UITextFieldDelegate,UIPickerViewDelegate> { NSMutableArray *arrayStrings;} I have a method that adds new NSStrings to the arrayStrings. My goal is to be able to pass the arrayStrings to the RootViewController by trying something similar to allClasses = arrayStrings. That way when the RootViewController is loaded it can populate with new information. How would I got about accomplishing that task?

    Read the article

  • Populating cell in UITableView with unique items

    - by aahrens
    I have an array of URL Links that I'm trying to load into a Grouped UITableView. The goal being that I have numberOfSectionsInTableView return [url count] so I can have number of sections equal to the number of url links. Then in numberOfRowsInSection returns 1 so I only populate 1 URL for each section. The trouble I'm having is to ensure that cellForRowAtIndexPath won't keep grabbing the first url link. I suspect it's because it's always grabbing the first url because the rowIndex is always zero. Any ideas how to ensure that each cell in my UITableView is populated with a different url link? - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return [newsItems count]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 1; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *MyIdentifier = @"MyIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] autorelease]; cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease]; cell.textLabel.lineBreakMode = UILineBreakModeWordWrap; cell.textLabel.numberOfLines = 5; } // Configure the cell. Get the title of the news item that was parsed out int newsItemIndex = [indexPath indexAtPosition: [indexPath length] - 1]; [cell.textLabel setText:[[newsItems objectAtIndex: newsItemIndex] objectForKey: @"link"]]; return cell; }

    Read the article

  • Saving an NSMutableArray of custom Objects

    - by aahrens
    I have a custom class that is used as a wrapper to an NSMutableArray @interface AllCourses : NSObject { NSMutableArray *arrClasses; } The array above stores Objects of another custom class. @interface Course : NSObject { NSString *className; NSString *classGrade; NSInteger creditHours; } I use the method below to add Course objects to my AllCourses //Adds a new Course to the total Courses -(void) addClass:(Course *)aCourse{ [arrClasses addObject:aCourse]; } What's going to be the best way to save the arrClasses MutableArray in AllCourses so that when my app loads it can keep the saved data the user already entered and populate it?

    Read the article

  • iPhone: Using a NSMutableArry in the AppDelegate as a Global Variable

    - by aahrens
    What i'm trying to accomplish is to have an NSMutableArray defined in the AppDelegate. I then have two UIViewControllers. One view is responsible for displaying the array from the AppDelegate. The other view is used to add items to the array. So the array starts out to be empty. View1 doesn't display anything because the array is empty. The User goes to View2 and adds an item to the array in AppDelegate. Then when the user goes back to View1 it now displays one item. Here is how I'm trying to accomplish this @interface CalcAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; UITabBarController *tabBarController; NSMutableArray *globalClasses; } @property (nonatomic,retain) NSMutableArray *globalClasses; My other view In the viewDidload I set the array in my View to be the one in the AppDelegate. In an effort to retain values. allCourses = [[NSMutableArray alloc]init]; CalcAppDelegate *appDelegate = (CalcAppDelegate *)[[UIApplication sharedApplication] delegate]; allCourses = appDelegate.globalClasses; Then I would update my allCourses array by adding a new item. Then try to set the array in the AppDelegate to be equal to the modified one. CalcAppDelegate *appDel = (CalcAppDelegate *)[[UIApplication sharedApplication] delegate]; NSLog(@"Size before reset %d",[appDel.globalClasses count]); appDel.globalClasses = allCourses; NSLog(@"Size after reset %d",[appDel.globalClasses count]); What I'm seeing that's returned is 2 in the before, and 2 after. So it doesn't appear to be getting updated properly. Any suggestions?

    Read the article

  • Switching between TabBarController Views when event fired

    - by aahrens
    I have a UITabBarController with two different views to switch between. What I would like to do is when a button is clicked in View1 to switch directly to View2. Then in View2 if they click a button it switches them to View1. It transfers between View1 and View2 when the click on the tabBarController fine but I'm trying to perform the switching for them when an event occurs Is there a way to do this by calling a method on my UITabBarController? @interface CalcAppDelegate : NSObject <UIApplicationDelegate> { UITabBarController *tabBarController; }

    Read the article

1