Developer Area

Changeset 634 for apps

Show
Ignore:
Timestamp:
01/11/10 21:40:07 (4 years ago)
Author:
henri
Message:

Further improvements to Keyword editing

Location:
apps/iphone/my.tel/trunk/Classes
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • apps/iphone/my.tel/trunk/Classes/HATypePickerController.h

    r633 r634  
    2727- (void)presentViewController; 
    2828- (void)dismissViewController; 
     29- (void)selectRowWithString:(NSString *)aString inComponent:(NSInteger)aComponent animated:(BOOL)animated; 
    2930- (IBAction)didCancelPicker:(id)sender; 
    3031- (IBAction)didAcceptPicker:(id)sender; 
    3132 
    3233@property (nonatomic, retain) IBOutlet UIPickerView *picker; 
    33 @property (nonatomic,assign) id <HATypePickerViewDelegate> delegate; 
     34@property (nonatomic, assign) id <HATypePickerViewDelegate> delegate; 
    3435@end 
  • apps/iphone/my.tel/trunk/Classes/HATypePickerController.m

    r633 r634  
    1515@dynamic delegate; 
    1616 
     17- (void)viewDidLoad { 
     18        [super viewDidLoad]; 
     19        self.delegate = delegate; 
     20} 
     21 
    1722- (void)presentViewController { 
    1823        UIWindow *win = [UIApplication sharedApplication].keyWindow; 
     
    3035        if (self.view.window) { 
    3136                [self.view removeFromSuperview]; 
    32                 CATransition *animation = [CATransition animation]; 
    33                 [animation setDelegate:self]; 
    34                 [animation setType:kCATransitionMoveIn]; 
    35                 [animation setSubtype:kCATransitionFromBottom]; 
    36                 [animation setDuration:0.5f]; 
    37                 [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; 
    38                 [[self.view.window layer] addAnimation:animation forKey:@"kEditAnimation"]; 
    3937        } 
    4038} 
    4139 
    42 - (void)viewDidLoad { 
    43         [super viewDidLoad]; 
    44         self.delegate = delegate; 
     40- (void)selectRowWithString:(NSString *)aString inComponent:(NSInteger)aComponent animated:(BOOL)animated { 
     41        NSInteger numRows = [picker numberOfRowsInComponent:aComponent]; 
     42        for (NSInteger i=0; i<numRows; i++) { 
     43                if ([[picker.delegate pickerView:picker titleForRow:i forComponent:aComponent] isEqualToString:aString]) { 
     44                        [picker selectRow:i inComponent:aComponent animated:animated]; 
     45                        return; 
     46                } 
     47        } 
    4548} 
    4649 
  • apps/iphone/my.tel/trunk/Classes/KeywordEditController.h

    r633 r634  
    4444        BOOL isEditing; 
    4545        NSInteger rowBeingEdited; 
     46        HATypePickerController *typePickerController; 
    4647} 
    4748 
  • apps/iphone/my.tel/trunk/Classes/KeywordEditController.m

    r633 r634  
    5050        [buttonSave retain]; 
    5151        self.navigationItem.rightBarButtonItem = buttonSave; 
     52        typePickerController = [[HATypePickerController alloc] initWithNibName:@"HATypePickerController" 
     53                                                                                                                                        bundle:nil]; 
    5254        return self; 
    5355} 
     
    7274- (void)dealloc { 
    7375        [buttonSave release]; 
     76        [typePickerController release]; 
    7477    [super dealloc]; 
    7578} 
     
    232235 
    233236        if (indexPath.section == kKKeywordEditTableViewSectionType) { 
    234                 HATypePickerController *typePickerController = [[[HATypePickerController alloc] initWithNibName:@"HATypePickerController" 
    235                                                                                                                                                                                                  bundle:nil] autorelease]; 
    236237                typePickerController.delegate = self; 
    237238                [typePickerController presentViewController]; 
     239                [typePickerController selectRowWithString:[delegate longNameForKeyword:self.primaryType] 
     240                                                                          inComponent:0 
     241                                                                                 animated:0]; 
    238242        } else if (indexPath.section == kKKeywordEditTableViewSectionValue) { 
    239243                NSString *tvEditTitle = [delegate longNameForKeyword:self.primaryType];          
     
    319323                [JsonConnection throwJsonErrorAlert:parsedJson]; 
    320324        } 
     325        [self.delegate dataDidChangeInController:self]; 
    321326} 
    322327 
  • apps/iphone/my.tel/trunk/Classes/KeywordViewController.m

    r633 r634  
    5757        keywordTableHeight = kKRowHeight; 
    5858        self.title = @"Keywords"; 
    59 } 
    60  
    61 - (void)viewWillAppear:(BOOL)animated { 
    62         [super viewWillAppear:animated]; 
    6359        // Don't get the data if we preloaded 
    6460        if (didPreload) { 
     
    6864                [self getKeywords]; 
    6965        } 
     66} 
     67 
     68- (void)viewWillAppear:(BOOL)animated { 
     69        [super viewWillAppear:animated]; 
    7070} 
    7171 
     
    170170- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 
    171171        CGFloat rowSize = 30;   // title + borders 
    172         CGSize constrainedSize = CGSizeMake([UIScreen mainScreen].bounds.size.width - 50, 200); 
     172        CGSize constrainedSize = CGSizeMake([UIScreen mainScreen].bounds.size.width - 50, 400); 
    173173        NSDictionary *uiItem = [[uiArray objectAtIndex:indexPath.row] retain]; 
    174174        NSString *primaryValue = [uiItem objectForKey:@"value"]; 
Telnic
Search This Site
Partners
Neustar
ICANN
Main site | WHOIS | Sell .tel | FAQ | Archived Site | About Telnic | Contact Us