Search Results

Search found 3 results on 1 pages for 'lucastizma'.

Page 1/1 | 1 

  • Keyboard Animation Issues When Calling becomeFirstResponder within a Modal View Controller

    - by LucasTizma
    I've been having some issues with calling -becomeFirstResponder on a UITextField contained with a view controller that is presented modally. I call this method in the modal view controller's -viewDidLoad method so that the keyboard is immediately displayed. What I expected is for both the keyboard and the modal view controller to animate from up the bottom of the screen at the same time. However, what I'm observing is the following: There is a ~0.2 second UI lag between clicking the button that calls the -presentModalViewController:animated: method on the parent view controller and when the child view controller begins to animate modally. The keyboard is immediately presented with absolutely no animation about half-way through the modal view controller's animation. Once the modal view controller's animation is complete, everything else seems to operate smoothly. Dismissing the modal view controller results in it being smoothly animated off screen (along with the keyboard, coincidentally). It's as if the keyboard's animation and the modal view controller's animation are both competing for some lower-level Core Animation resource at the same time, but I don't see why this should be happening. What further seems to corroborate this hunch is if I don't ask the UITextField to become the first responder (i.e., if I don't ask the keyboard to present itself), then there is absolutely no UI lag, and the modal view controller animates instantly. Interestingly, if I do something like [self.textField performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.0001]; then the animation of the keyboard happens nearly at the same time as the modal view controller's animation -- it's extremely difficult to tell that they aren't both being animated at the exact same time. Furthermore, there's no more UI lag. Has anyone experienced anything similar to this?

    Read the article

  • Objective-C Protocols within Protocols

    - by LucasTizma
    I recently began trying my hand at using protocols in my Objective-C development as an (obvious) means of delegating tasks more appropriately among my classes. I completely understand the basic notion of protocols and how they work. However, I came across a roadblock when trying to create a custom protocol that in turn implements another protocol. I since discovered the solution, but I am curious why the following DOES NOT work: @protocol STPickerViewDelegate < UIPickerViewDelegate > - ( void )customCallback; @end @interface STPickerView : UIPickerView { id < STPickerViewDelegate > delegate; } @property ( nonatomic, assign ) id < STPickerViewDelegate > delegate; @end Then in a view controller, which conforms to STPickerViewDelegate: STPickerView * pickerView = [ [ STPickerView alloc ] init ]; pickerView.delegate = self; - ( void )customCallback { ... } - ( NSString * )pickerView:( UIPickerView * )pickerView titleForRow:( NSInteger )row forComponent:( NSInteger )component { ... } The problem was that pickerView:titleForRow:forComponent: was never being called. On the other hand, customCallback was being called just fine, which isn't too surprising. I don't understand why STPickerViewDelegate, which itself conforms to UIPickerViewDelegate, does not notify my view controller when events from UIPickerViewDelegate are supposed to occur. Per my understanding of Apple's documentation, if a protocol (A) itself conforms to another protocol (B), then a class (C) that conforms to the first protocol (A) must also conform to the second protocol (B), which is exactly the behavior I want and expected. What I ended up doing was removing the id< STPickerViewDelegate > delegate property from STViewPicker and instead doing something like the following in my STViewPicker implementation where I want to evoke customCallback: if ( [ self.delegate respondsToSelector:@selector( customCallback ) ] ) { [ self.delegate performSelector:@selector( customCallback ) ]; } This works just fine, but I really am puzzled as to why my original approach did not work.

    Read the article

  • -sizeWithFont Functions Differently on Device

    - by LucasTizma
    So I am seemingly encountering some strange behavior when using NSString's -sizeWithFont family of method calls depending on whether or not I'm invoking it on the iPhone Simulator or an actual device. Simply enough, when the receiver of the -sizeWithFont method call is nil, the resulting CGSize passed back on the Simulator is {0, 0}. However, on the device, it is the size of the bounding rectangle I specified in the method call. See the following log statements: Simulator: someString: (null) someStringSize: {0, 0} Device: someString: (null) someStringSize: {185, 3.40282e+38} The behavior on the Simulator is what I would expect. Not that this issue is difficult to circumvent, but 1) I'm a little confused why this family of functions would behave differently on the Simulator and an actual device, and 2) why does calling a method on a nil receiving return a particular result? Thanks for any pointers or insight you guys can provide! EDIT: I suppose I should mention that I'm building against the 3.1 SDK.

    Read the article

1