Search Results

Search found 32 results on 2 pages for 'uipicker'.

Page 2/2 | < Previous Page | 1 2 

  • iphone float vs integer rounding?

    - by Rob
    Okay, from what I understand, an integer that is a fraction will be rounded one way or the other so that if a formula comes up with say 5/6 - it will automatically round it to 1. I have a calculation: xyz = ((1300 - [abc intValue])/6) + 100; xyz is defined as an NSInteger, abc is an NSString that is chosen via a UIPicker. I want the calculation (1300 - [abc intValue]) to add 1 to 100 for each 6 units below 1300. For example, 1255 should result in xyz having a value of 100 and 1254 should result in a value of 101. Now, I understand that my formula above is wrong because of the rounding principles, but I am getting some CRAZY results from the program itself. When I punched in 1259 - I got 106. When I punched in 1255 - I got 107. Why would it behave that way?

    Read the article

  • UiPickerView change font color according data

    - by Fulkron
    I'm using a pickerView with multiple components related to several fields in a Database (CoreData). Is it possible to change the fontcolor for a specific component according the presence of data in the DB ? For example the field in the DB is null the component font color should be RED otherwise black. Any help will be appreciated ! Dario ================== Thanks Kenny, I have to apply to a single UIPicker only. So I', returning the view parametere (without modificatiosn). The result is all the pickers show empty rows. Thanks for help ! Here you will find the code fragment: - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view { if (pickerView == tipoPk){ UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100,30)]; label.textColor = [UIColor redColor]; switch (component) { case PK_Tipo: label.text = [tipoArray objectAtIndex:row]]; break; case PK_Settore: label.text = [settoreArray objectAtIndex:row]]; break; default: break; } return label; } else { return view; // <==== return view for non related pickerviews , but no rows shown } }

    Read the article

  • iPhone SDK: Memory leak on picker

    - by bbftsoftware
    I have created a picker for my users to pick from a list of countries. The problem is that repeated opening and closing of the picker is resulting in “EXC_BAD_ACCESS” error. I suspect it might be a memory leak but I am not sure. I was hoping someone could shed some insight into why this might be happening? //data source for UIPicker NSArray *arrayCountryChoices; arrayCountryChoices = [[NSArray alloc] initWithObjects:@"TK=TOKELAU", @"TJ=TAJIKISTAN", @"TH=THAILAND", @"TG=TOGO", @"TF=FRENCH SOUTHERN TERRITORIES", @"GY=GUYANA", @"TD=CHAD", nil]; //opening the picker CountryViewController *countryVC = [[CountryViewController alloc] initWithNibName:@"CountryView" bundle:nil]; countryVC.delegate = self; [self presentModalViewController:countryVC animated:YES]; [countryVC release]; //here is where I grab the data //close country selector [self dismissModalViewControllerAnimated:YES]; //parse out code NSString *strCode = [chosenCountry substringToIndex:2]; //set the gui txtCountry.text = strCode; I think it may be because I am trying to release the Country Selector before the delegate has a chance to get its data? Also I am wondring if I should not release the picker until the screen that calls it is released. Thanks in advance.

    Read the article

  • Difficulty with apps with a forced landscape orientation

    - by mahboudz
    I have two apps, both of which force the user to use the iPhone in landscape mode, in order to have a wider screen, instead of a taller one. One of the things I have found is that my first view will look fine, but all other views come up with their subviews (UIButtons, UIPicker, UIViews) squeezed to one side or clipped (depending on whether the elements were set to move, resize or stay in the same position as the view size changed). All my views are designed in IB in the landscape orientation. My underlying UIWindow, and everything I can think of has been laid out in landscape orientation. Even my plist file has the UIInterfaceOrientationLandscapeRight flag set. Now, if I load all my views at the same time as my rootview controller, then I have no problems. But if I have views loaded later, they get clipped or squeezed. The only way to get around the problem was to add the following line in my code that flips in a new view: [coming.view setFrame:CGRectMake(0, 0, 480, 300)]; Anyone know why I need to do this? Is it just that the iPhone assumes that loaded views are 300x480 unless a transform gets applied to them? Thanks. ps. This is what the view looks like if I don't call setFrame, as described above: All viewcontrollers that get loaded after the first one will have their screen similarly squeezed down. For some reason the first viewcontroller doesn't have this issue.

    Read the article

  • IPhone custom UITableViewCell Reloading

    - by Steblo
    Hi, currently I'm struggling with this problem: I got a UITableViewController that displays a tableView with different custom cells. One custom cell displays a number (by a label). If you click on this cell, the navigationController moves to a UIPicker where the user can select the number to be displayes. If the user moves back, the cell should display the updated value. Problem: I managed to reload the cells by calling - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self.tableView reloadData]; } in the UITableViewController. This works only, if I don't use dequeueReusableCellWithIdentifier for the cell (tables won't show updates otherwise). But in this case, memory usage grows and grows... In addition, the program crashes after about 15 movements to pickerView and back - I think because the cell that should be reloaded is already released. How can I update a reusable custom cell every time the view appears ? What is the best solution ? I think retaining cells should not be used ?

    Read the article

  • objective-c having issues with an NSDictioary object

    - by Mark
    I have a simple iPhone app that Im learning and I want to have an instance variable called urlLists which is an NSDictionary I have declared it like so: @interface MyViewController : UIViewController <UIPickerViewDataSource, UIPickerViewDelegate>{ IBOutlet UIPickerView *pickerView; NSMutableArray *categories; NSDictionary *urlLists; } @property(retain) NSDictionary *urlLists; @end and in the implementation: @implementation MyViewController @synthesize urlLists; ... - (void)viewDidLoad { [super viewDidLoad]; categories = [[NSMutableArray alloc] init]; [categories addObject:@"Sport"]; [categories addObject:@"Entertainment"]; [categories addObject:@"Technology"]; [categories addObject:@"Political"]; NSArray *objects = [NSArray arrayWithObjects:@"value1", @"value2", @"value3", @"value4", nil]; urlLists = [NSDictionary dictionaryWithObjects:objects forKeys:categories]; for (id key in urlLists) { NSLog(@"key: %@, value: %@", key, [urlLists objectForKey:key]); } } ... @end And, this all works up to here. I have added a UIPicker to my app, and when I select one of the items, I want to Log the one picked and its related entry in my dictionary. -(void) pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger) component { for (id key in self.urlLists) { NSLog(@"key: %@, value: %@", key, [urlLists objectForKey:key]); } } but I get the old EXC_BAD_ACCESS error... I know Im missing something small, but what? Thanks

    Read the article

  • Few iPhone noob questions

    - by mshsayem
    Why should I declare local variables as 'static' inside a method? Like: static NSString *cellIdentifier = @"Cell"; Is it a performance advantage? (I know what 'static' does; in C context) What does this syntax mean?[someObj release], someObj = nil; Two statements? Why should I assign nil again? Is not 'release' enough? Should I do it for all objects I allocate/own? Or for just view objects? Why does everyone copy NSString, but retains other objects (in property declaration)? Yes, NSStrings can be changed, but other objects can be changed also, right? Then why 'copy' for just NSString, not for all? Is it just a defensive convention? Shouldn't I release constant NSString? Like here:NSString *CellIdentifier = @"Cell"; Why not? Does the compiler allocate/deallocate it for me? In some tutorial application I observed these (Built with IB): Properties(IBOutlet, with same ivar name): window, someLabel, someTextField, etc etc... In the dealloc method, although the window ivar was released, others were not. My question is: WHY? Shouldn't I release other ivars(labels, textField) as well? Why not? Say, I have 3 cascaded drop-down lists. I mean, based on what is selected on the first list, 2nd list is populated and based on what is selected on the second list, 3rd list is populated. What UI components can reflect this best? How is drop-down list presented in iPhone UI? Tableview with UIPicker? When should I update the 2nd, 3rd list? Or just three labels which have touch events? Can you give me some good example tutorials about Core-Data? (Not just simple data fetching and storing on 2/3 tables with 1/2 relationship) How can I know whether my app is leaking memory? Any tools?

    Read the article

< Previous Page | 1 2