Search Results

Search found 7 results on 1 pages for 'morticae'.

Page 1/1 | 1 

  • Add an objective @property attribute in objective-c

    - by morticae
    Does anyone know of a way to add additional attribute types to the @property keyword without modifying the compiler? Or can anyone think of another way to genericize getter/setter creation? Basically, I have a lot of cases in a recent project where it's handy for objects to lazily instantiate their array properties. This is because we have "event" objects that can have a wide variety of collections as properties. Subclassing for particular events is undesirable because many properties are shared, and it would become a usability nightmare. For example, if I had an object with an array of songs, I'd write a getter like the following: - (NSMutableArray *)songs { if (!songs) { songs = [[NSMutableArray alloc] init]; } return songs; } Rather than writing dozens of these getters, it would be really nice to get the behavior via... @property (nonatomic, retain, lazyGetter) NSMutableArray *songs; Maybe some fancy tricks via #defines or something? Other ideas?

    Read the article

  • UIDatePicker locale does nothing?

    - by morticae
    I'm creating a UIDatePicker programmatically, and setting its locale with the following code: datePicker.locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"es_ES"] autorelease]; The datepicker still appears in English (or whatever language I've set the phone to). Anyone have any idea why this does nothing, or how to fix it?

    Read the article

  • How listen for UIButton state change?

    - by morticae
    I'm extending UIButton with generic functionality to change certain appearance attributes based on the displayed title. In order to do this, I need to detect and respond to changes in the "state" property. This is so I make sure the appearance is adjusted properly if the user has set different titles for different states. I assumed I would need to use some sort of KVO like the following: [self addObserver:self forKeyPath:@"state" options:NSKeyValueObservingOptionNew context:nil]; But this does not seem to fire the observeValueForKeyPath:... method for @"state" or @"currentTitle". I assume this is because UIButton does not implement the KVO pattern for those properties. I do not want to just listen for clicks. Those events cause a state change, but are not the only potential causes. Does anyone know a way to listen to and respond to state changes of a UIButton? Thanks

    Read the article

  • How to unset delegate on UIView setAnimationDelegate: call?

    - by morticae
    I am receiving crash reports that appear to be from a UIView animation calling a delegate that has been dealloced. Thread 0 Crashed: 0 libobjc.A.dylib 0x334776f6 objc_msgSend + 18 1 UIKit 0x31c566c4 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] 2 UIKit 0x31c565d2 -[UIViewAnimationState animationDidStop:finished:] 3 QuartzCore 0x30045a26 run_animation_callbacks I am setting the current view controller as the delegate for animations using the following pattern: [UIView beginAnimations:nil context:NULL]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationDuration:0.5]; [UIView setAnimationDelegate:self]; ... [UIView commitAnimations]; My question is, how do I set that delegate reference to nil in my dealloc method? Is there some way to retain a reference to an animation? Or fetch animations in progress?

    Read the article

  • Unselected UIPickerView value

    - by morticae
    According to the documentation, if a UIPickerView has no selected value, the expected return from selectedRowInComponent: should be: "A zero-indexed number identifying the selected row, or -1 if no row is selected." However, if I check the value the very line after initializing one, its value is 0. Even if I then manually set it to -1, it still returns 0. I would like to be able to detect whether the user has chosen a value yet or not, without recording it in a local variable. Is this possible? example: UIPickerView *picker = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0, 46.0, 320.0, 216.0)]; [picker selectRow:-1 inComponent:0 animated:NO]; NSLog(@"SELECTED %d", [picker selectedRowInComponent:0]); expected output: SELECTED -1 actual output: SELECTED 0

    Read the article

  • UIAlertView crashing on undocumented method

    - by morticae
    Our app has been crashing with a frequency of roughly 1 in 1,500 launches due to a bug that is proving elusive. The relevant portion of the stack trace is included. It's being fired as a callback so I have no reference for where it's occurring in my own code. It looks like what's going on is there is a UIViewAnimationState object that is calling UIAlertView's private method (_popoutAnimationDidStop:finished:). Only problem is, it appears the UIAlertView has been dealloced by this point. I don't do anything weird with alert views. I throw them up, and I wait for user input. They are all shown before being released. Anyone encountered this? At this point, I'm leaning toward it being an Apple bug. Thread 0 Crashed: 0 libobjc.A.dylib 0x3138cec0 objc_msgSend + 24 1 UIKit 0x326258c4 -[UIAlertView(Private) _popoutAnimationDidStop:finished:] 2 UIKit 0x324fad70 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] 3 UIKit 0x324fac08 -[UIViewAnimationState animationDidStop:finished:] 4 QuartzCore 0x311db05c run_animation_cal lbacks

    Read the article

  • plist vs static array

    - by morticae
    Generally, I use static arrays and dictionaries for containing lookup tables in my classes. However, with the number of classes creeping quickly into the hundreds, I'm hesitant to continue using this pattern. Even if these static collections are initialized lazily, I've essentially got a bounded memory leak going on as someone uses my app. Most of these are arrays of strings so I can convert strings into NSInteger constants that can be used with switch statements, etc. I could just recreate the array/dictionary on every call, but many of these functions are used heavily and/or in tight loops. So I'm trying to come up with a pattern that is both performant and not persistent. If I store the information in a plist, does the iphoneOS do anything intelligent about caching those when loaded? Do you have another method that might be related?

    Read the article

1