Monthly Archives: February 2015

Dismiss keyboard on touch anywhere outside UITextField

http://stackoverflow.com/questions/5306240/iphone-dismiss-keyboard-when-touching-outside-of-uitextfield

In viewDidLoad

In dismissKeyboard:

property declaration without synthesize

http://www.techrepublic.com/blog/software-engineer/what-you-need-to-know-about-automatic-property-synthesis/

.m

  • By prefixing playerName with self. you will access the property
  • without it you will directly reference the instance variable

Hence self.playerName = @”hehe”, will make you access the either automatically generated set or custom set method.

whereas playerName = @”hehe”, will literally have you use the instance variable.

No Synthesize

Without @synthesize probability in the .m file,

_probability is the iVar
self.probability means to access the automatically generated get/set methods

try it

PopUpViewcontroller use retained property variable

when using PopUpViewcontroller, make sure the variable you assign to it has property strong so that it doesn’t get released.

Else, you’ll get a EXE_ACCESS error.

Notice below of self.singleColPickerPopup:

Change from NSDate to NSString

Custom UITableViewCell

JSCustomCell.h

JSCustomCell.m

result:

ViewController.h

ViewController.m

Change animation style of UIViewController

reference: http://stackoverflow.com/questions/1406037/custom-animation-for-pushing-a-uiviewcontroller

method 1

In the parent view controller, you have a button that brings in the a UIViewController. In your button responder, you go:

In the UIViewController:

Method 2

I use the following function (added to UINavigationController) to customize the push animation: