Categories
iPhone app

Two mac tips

Reading Time: < 1 minute

Last Updated on January 20, 2017 by stlplace

1) This puzzelled me for a while, my macbook air run out of space often. I was trying to use the build “Finder” to find large files, delete files and some unused apps, to no avail. I did some more google and used this Mac App “FindSpace”. And I found this directory /var/vm has some large swap files. Aha. Found the culprit. This article from osxdaily has more explanation.

2) Old Macbook heat. My 3 years old macbook air recently has the problem of overheat. It heated up fairly quickly after using 10 to 15 minutes. Did some google and found this one described my symptom well. The solution appears to be “SMC reset”. I did it yesterday and it works better at least for now…

(01-02-2017) I found chrome can take a lot space too, as well as the iTunes (iPhone) backup file (appears under mobile sync). Also the MacBook Pro retina has similar battery issue (cannot charge), did Smc reset, worked a while. Eventually had to send to Apple Store for a complete fix.

Categories
iPhone app

Three way to create customized input control for UITextField

Reading Time: < 1 minute

Last Updated on September 5, 2012 by stlplace

Recently I need to create some customized textfield to input numbers and text on iPad. I don’t like the default keyboard on iPad because it takes too much of the screen, and in some cases covers up the input field.

1) From iphonedevsdk: What is proper way to do UITextField text change call back? (this also mentioned by stackoverflow)

[textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventTouchDown];

The downside of this approach is: it takes a press (a tap and hold) to trigger the event.

2) InputView
Create a customized view such as this one at raywenderlich, then set the inputView of textfield. I used this approach to create a number pad that used to only input numbers. There is some limit to this approach as well: the location of customized input view is usually fixed, and in my case (a double picker) for text field (table cell), that is not ideal. I was using pop over controller (again raywenderlich), combined with approach 1, the user does not like the “hold”. After I changed to approach 2, the user does not like the fixed location of input view. So I did more research, and eventually I found the following approach that works for me.

One tip: make sure lock the input view, otherwise it will mess up things after iPad rotation.
– (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return NO;
}

3) self delegate, UITextFieldDelegate

Make sure do this in viewDidLoad (or other place initialize the text field):
myTextField.delegate = self;

This way I could have both “single tap” and the pop over controller.