Search Results

Search found 8 results on 1 pages for 'tzur gazit'.

Page 1/1 | 1 

  • How to set a reference from one object to another?

    - by Tzur Gazit
    Hi, Imagine the obvious model of employees and departments, where each employee must refer to a single department, and each department may have none to many employees. For Employee I have a pointer to Department, and I set its value to the address of the object of the relevant Department. When I try to save the Employee I get an error: 2010-04-07 10:05:22.491 CoreData2[1112:207] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: Department)' I tried, just for testing, to make the reference from Employee to Department optional, but I get the same result. I'm having my first steps in CoreData so please be as clear and simple as you can. Thanks, Tzur.

    Read the article

  • Can't access annotation property of subclassed uibutton

    - by Tzur Gazit
    I have a mapView to which I add annotations. The pin's callout have a button (rightCalloutAccessoryView). In order to be able to display various information when the button is pushed, i've subclassed uibutton and added a class called "Annotation". @interface CustomButton : UIButton { NSIndexPath *indexPath; Annotation *mAnnotation; } @property (nonatomic, retain) NSIndexPath *indexPath; @property (nonatomic, copy) Annotation *mAnnotation; - (id) setAnnotation2:(Annotation *)annotation; @end Here is "Annotation": @interface Annotation : NSObject <MKAnnotation> { CLLocationCoordinate2D coordinate; NSString *mPhotoID; NSString *mPhotoUrl; NSString *mPhotoName; NSString *mOwner; NSString *mAddress; } @property (nonatomic, assign) CLLocationCoordinate2D coordinate; @property (nonatomic, copy) NSString *mPhotoID; @property (nonatomic, copy) NSString *mPhotoUrl; @property (nonatomic, copy) NSString *mPhotoName; @property (nonatomic, copy) NSString *mOwner; @property (nonatomic, copy) NSString *mAddress; - (id) initWithCoordinates:(CLLocationCoordinate2D)coordinate; - (id) setPhotoId:(NSString *)id url:(NSString *)url owner:(NSString *)owner address:(NSString *)address andName:(NSString *)name; @end I want to set the annotation property of the uibutton at - (MKAnnotationView *)mapView:(MKMapView *)pMapView viewForAnnotation:(id )annotation, in order to refer to it at the button push handler (-(IBAction) showDetails:(id)sender). The problem is that I can't set the annotation property of the button. I get the following message at run time: 2010-04-27 08:15:11.781 HotLocations[487:207] *** -[UIButton setMAnnotation:]: unrecognized selector sent to instance 0x5063400 2010-04-27 08:15:11.781 HotLocations[487:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIButton setMAnnotation:]: unrecognized selector sent to instance 0x5063400' 2010-04-27 08:15:11.781 HotLocations[487:207] Stack: ( 32080987, 2472563977, 32462907, 32032374, 31884994, 55885, 30695992, 30679095, 30662137, 30514190, 30553882, 30481385, 30479684, 30496027, 30588515, 63333386, 31865536, 31861832, 40171029, 40171226, 2846639 ) I appreciate the help. Tzur.

    Read the article

  • Can't access annotation property of subclassed uibutton - editted

    - by Tzur Gazit
    Below is my original question. I kept investigating and found out that the type of the button I allocate is of type UIButton instead of the subclassed type CustomButton. the capture below is the allocation of the button and connection to target. I break immediately after the allocation and check the button type (po rightButton at the debugger console). It's turned out tht the type is UIButton instead of CustomButton. CustomButton* rightButton = [CustomButton buttonWithType:UIButtonTypeDetailDisclosure]; [rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside]; I have a mapView to which I add annotations. The pin's callout have a button (rightCalloutAccessoryView). In order to be able to display various information when the button is pushed, i've subclassed uibutton and added a class called "Annotation". @interface CustomButton : UIButton { NSIndexPath *indexPath; Annotation *mAnnotation; } @property (nonatomic, retain) NSIndexPath *indexPath; @property (nonatomic, copy) Annotation *mAnnotation; - (id) setAnnotation2:(Annotation *)annotation; @end Here is "Annotation": @interface Annotation : NSObject <MKAnnotation> { CLLocationCoordinate2D coordinate; NSString *mPhotoID; NSString *mPhotoUrl; NSString *mPhotoName; NSString *mOwner; NSString *mAddress; } @property (nonatomic, assign) CLLocationCoordinate2D coordinate; @property (nonatomic, copy) NSString *mPhotoID; @property (nonatomic, copy) NSString *mPhotoUrl; @property (nonatomic, copy) NSString *mPhotoName; @property (nonatomic, copy) NSString *mOwner; @property (nonatomic, copy) NSString *mAddress; - (id) initWithCoordinates:(CLLocationCoordinate2D)coordinate; - (id) setPhotoId:(NSString *)id url:(NSString *)url owner:(NSString *)owner address:(NSString *)address andName:(NSString *)name; @end I want to set the annotation property of the uibutton at - (MKAnnotationView *)mapView:(MKMapView *)pMapView viewForAnnotation:(id )annotation, in order to refer to it at the button push handler (-(IBAction) showDetails:(id)sender). The problem is that I can't set the annotation property of the button. I get the following message at run time: 2010-04-27 08:15:11.781 HotLocations[487:207] *** -[UIButton setMAnnotation:]: unrecognized selector sent to instance 0x5063400 2010-04-27 08:15:11.781 HotLocations[487:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIButton setMAnnotation:]: unrecognized selector sent to instance 0x5063400' 2010-04-27 08:15:11.781 HotLocations[487:207] Stack: ( 32080987, 2472563977, 32462907, 32032374, 31884994, 55885, 30695992, 30679095, 30662137, 30514190, 30553882, 30481385, 30479684, 30496027, 30588515, 63333386, 31865536, 31861832, 40171029, 40171226, 2846639 ) I appreciate the help. Tzur.

    Read the article

  • when/where should properties be released once the objects is pushed for display?

    - by Tzur Gazit
    Hi, I've defined a view controller with an array as one of its properties, and set the array with an allocated and autoreleased array. After I push the view for display I release it. By watching the leaks tool I see that every time that I pop the view I suffer from leakage. I tried to release the properties explicitly, immediately after the push but the app crashes. looking forward for your suggestions.

    Read the article

  • Math with interpolated variables?

    - by Idan Gazit
    Consider the following sass: $font-size: 18; $em: $font-size; $column: $font-size * 3; // The column-width of my grid in pixels $gutter: $font-size * 1; // The gutter-width of my grid in pixels $gutter-em: #{$gutter / $em}em; // The gutter-width in ems. $column-em: #{$column / $em}em; // The column-width in ems; $foo = $gutter-em / 2; // This results in a value like "1em/2". :( $bar = ($gutter-em / 2); // this doesn't work either, same as above. How can I generate a $foo that works, and that I can reuse further in other expressions?

    Read the article

  • How to force a textField to become editable?

    - by Tzur Gazit
    I have a custom tableViewCell with a UITextLabel inside it. When the cell is first displayed, the place holder is shown and then disappears when the user types something in. What I want is to go back to the parent view, and then to the sub view again, and that the field will show the text that the user previously typed. If I set the text field, simply with setText, the textField is not editable. Any idea?

    Read the article

  • Fail to save a managed object to core-data after its properties were updated.

    - by Tzur Gazit
    I have to trouble to create the object, but updating it fails. Here is the creation code: // Save data from pList to core data fro the first time - (void) saveToCoreData:(NSDictionary *)plistDictionary { // Create system parameter entity SystemParameters *systemParametersEntity = (SystemParameters *)[NSEntityDescription insertNewObjectForEntityForName:@"SystemParameters" inManagedObjectContext:mManagedObjectContext]; //// // GPS SIMULATOR //// NSDictionary *GpsSimulator = [plistDictionary valueForKey:@"GpsSimulator"]; [systemParametersEntity setMGpsSimulatorEnabled:[[GpsSimulator objectForKey:@"Enabled"] boolValue]]; [systemParametersEntity setMGpsSimulatorFileName:[GpsSimulator valueForKey:@"FileName"]]; [systemParametersEntity setMGpsSimulatorPlaybackSpeed:[[GpsSimulator objectForKey:@"PlaybackSpeed"] intValue]]; [self saveAction]; } During execution the cached copy is changed and then it is saved (or trying) to the database. Here is the code to save the changed copy: // Save data from pList to core data fro the first time - (void) saveSystemParametersToCoreData:(SystemParameters *)theSystemParameters { // Step 1: Select Data NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"SystemParameters" inManagedObjectContext:mManagedObjectContext]; [fetchRequest setEntity:entity]; NSError *error = nil; NSArray *items = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error]; [fetchRequest release]; if (error) { NSLog(@"CoreData: saveSystemParametersToCoreData: Unresolved error %@, %@", error, [error userInfo]); abort(); } // Step 2: Update Object SystemParameters *systemParameters = [items objectAtIndex:0]; //// // GPS SIMULATOR //// [systemParameters setMGpsSimulatorEnabled:[theSystemParameters mGpsSimulatorEnabled]]; [systemParameters setMGpsSimulatorFileName:[theSystemParameters mGpsSimulatorFileName]]; [systemParameters setMGpsSimulatorPlaybackSpeed:[theSystemParameters mGpsSimulatorPlaybackSpeed]]; // Step 3: Save Updates [self saveAction]; } As to can see, I fetch the object that I want to update, change its values and save. Here is the saving code: - (void)saveAction { NSError *error; if (![[self mManagedObjectContext] save:&error]) { NSLog(@"ERROR:saveAction. Unresolved Core Data Save error %@, %@", error, [error userInfo]); exit(-1); } } The Persistent store method: - (NSPersistentStoreCoordinator *)persistentStoreCoordinator { if (mPersistentStoreCoordinator != nil) { return mPersistentStoreCoordinator; } NSString *path = [self databasePath]; NSURL *storeUrl = [NSURL fileURLWithPath:path]; NSError *error = nil; mPersistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]]; if (![mPersistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:nil error:&error]) { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } return mPersistentStoreCoordinator; } There is no error but the sqLite file is not updated, hence the data is not persistent. Thanks in advance.

    Read the article

1