Found and fixed another device rotation defect, was using wrong bounds to check screen size. Should have used self.tableView instead of [UIScreen mainScreen]:
Thursday, March 31, 2011
Beware Using [UIScreen mainScreen].bounds
Labels:
debug,
mainScreen,
NSLog,
rotation,
UIInterfaceOrientation,
UIScreen,
UITableView
Wednesday, March 30, 2011
How to Change UITextView Background Color
You have UIView, which contains UITextView with some text. This is how to change UITextView background color:
self.view.opaque = YES;Not what I was looking for, but might as well write down, looks useful enough. Another tool in the toolbox, even though everything still looks like a nail.
self.view.backgroundColor = [UIColor yellowColor];
self.textView.opaque = NO;
self.textView.backgroundColor = [UIColor clearColor];
self.textView.textColor = [UIColor orangeColor];
Labels:
clearColor,
opaque,
UIColor,
UITextView,
UIView
Sunday, March 27, 2011
Hide UITableView Empty Cell Separator Lines
Plain UITableView displays cell separator lines, when table is empty or has only a few real cells. This is the default behaviour - and it is good. You should not change it.
But sometimes it looks a bit too weird. When your cells have different heights, all empty cells following the last real one will use last cell's height. If this changes at every table refresh, the "jumping" empty cells start annoying users. Or at least developers.
But sometimes it looks a bit too weird. When your cells have different heights, all empty cells following the last real one will use last cell's height. If this changes at every table refresh, the "jumping" empty cells start annoying users. Or at least developers.
Labels:
CGRectZero,
separatorStyle,
tableFooterView,
UITableView,
UITableViewCell,
UIView
No New Fonts in iOS 4.3.1
Just checked iOS 4.3.1 update. There are no new fonts, when compared to iPhone or iPad running iOS 4.3. Don't have iPad2, but I doubt there's any new fonts in that device alone.
Sometimes no news is the news.
Previously released iOS 4.3 has new Noteworthy font and there is also a complete list of iOS 4.2.1 fonts.
Am I obsessed with fonts? Just a little bit :)
Sometimes no news is the news.
Previously released iOS 4.3 has new Noteworthy font and there is also a complete list of iOS 4.2.1 fonts.
Am I obsessed with fonts? Just a little bit :)
Saturday, March 26, 2011
How to Define Custom backBarButtonItem
When you push a UIViewController into navigation stack, there is a default "back" button with the title of previous view. Sometimes the title is too long or text is not quite right. Then you need to define your own.
Fortunately it's easy. The problem is where to do it.
Fortunately it's easy. The problem is where to do it.
Labels:
backBarButtonItem,
leftBarButtonItem,
navigationController,
navigationItem,
pushViewController,
UIBarButtonItem,
UIViewController,
viewDidLoad
Wednesday, March 23, 2011
Request for member 'item' in something not a structure or union
There are several ways how you can get this compiler error - and here's another one. With one way to fix it.
First setup everything:
First setup everything:
@interface MyPlayer : MPMoviePlayerViewControllerThis doesn't work, compiler error:
{
UIView *parentView;
}
@property (nonatomic, retain) UIView *parentView;
@end
@interface MyView : UIView
{
MyPlayer *myPlayer;
}
@end
self.myPlayer = [[MyPlayer alloc] init];This is ok:
self.myPlayer.parentView = self;
MyPlayer *player = [[MyPlayer alloc] init];Divide and conquer... If this didn't help you, remember to check that you import correct header files.
player.parentView = self;
self.myPlayer = player;
[player release];
Wednesday, March 16, 2011
How to Debug Webtrends.framework Linker Problems
You are trying to integrate Webtrends Analytics library as Webtrends.framework into your application and linker fails with lots of undefined symbols:
Monday, March 14, 2011
How to Copy Current Toolbar to Next NavigationController
Your application is based on idea of lists, where you can navigate deeper into sublists and then back again. There is a common set of actions, which you want to launch from toolbar at the bottom of each screen.
Sounds easy, except you need to define the toolbar separately for each UIViewController while navigating deeper into lists. That should be easier, right? Try this:
Sounds easy, except you need to define the toolbar separately for each UIViewController while navigating deeper into lists. That should be easier, right? Try this:
Labels:
addObserver,
initWithNibName,
NSNotificationCenter,
postNotificationName,
pushViewController,
UINavigationController,
UIToolbar
Thursday, March 10, 2011
New font with iOS 4.3
iOS 4.3 was released yesterday evening. Checked the built-in fonts right away and found out that none of the old ones are missing - and that there's a brand new font in both iPhone and iPad: Noteworthy.
Pre-release rumours said it was added for iPad Notes application, replacing Chalkboard SE. Looking at Notes in iOS 4.3 both iPhone and iPad are using Noteworthy.
Pre-release rumours said it was added for iPad Notes application, replacing Chalkboard SE. Looking at Notes in iOS 4.3 both iPhone and iPad are using Noteworthy.
Friday, March 4, 2011
How to Center Image when Rotating UIWebView
What happens, when you rotate iPhone while your application shows embedded webpage with custom background graphics? Hopefully the application rotates, too, and hopefully the background image has been designed well (*).
Here is an example how to top center backgroung image while rotating. Please note that the image has been poorly designed ON PURPOSE. Can't make a point with well designed graphics :)
Here is an example how to top center backgroung image while rotating. Please note that the image has been poorly designed ON PURPOSE. Can't make a point with well designed graphics :)
Labels:
html,
loadRequest,
NSBundle,
NSURL,
NSURLRequest,
shouldAutorotateToInterfaceOrientation,
UIViewController,
UIWebView,
viewDidLoad,
webKit
Wednesday, March 2, 2011
What to Do When Screen Auto-Lock Doesn't Work During Phonecall
Lesson 1: When iPhone is in headset mode, screensaver doesn't activate and/or screen doesn't go black. So unplug your headphones from the headphones socket... but remember this only effects proximity sensor.
Lesson 2: When you are debugging on hardware, the device is connected with USB cable to laptop. This cable does charging and thus screen won't go black. Unplug the USB cable, too. Now start recalling how debugging on hardware was done before cable connection was invented. Tip: log files!
Lesson 3: Something I've learned much earlier, still good to remember. If you're debugging something audio related (like I was), check ALL volume controls. There's a possibility that something has been muted!
Lesson 2: When you are debugging on hardware, the device is connected with USB cable to laptop. This cable does charging and thus screen won't go black. Unplug the USB cable, too. Now start recalling how debugging on hardware was done before cable connection was invented. Tip: log files!
Lesson 3: Something I've learned much earlier, still good to remember. If you're debugging something audio related (like I was), check ALL volume controls. There's a possibility that something has been muted!
Labels:
debug,
device,
headphones,
headset,
iphone,
phone call
Subscribe to:
Posts (Atom)