uikit

Adding UIControl subclass in loadView crashes iphone app

Hi all, I'm new to iphone and experimenting with the platform. I have a root view controller which loads it's view from a nib. I accidentally uncommented the 'loadView' method in this class, and now the app crashes - is this because if a view controller is initiated from a nib then you can never have a loadView implementation? Taras ...

how to customize uitableview

Hi, I need to customize each cell in a UITableView (like each cell will have UITextfield and UIButton). Could you let me know if there is any good article on that? Thanks. ...

How can I make a class with only class methods, that is capable of remembering values? How does Core Animation do that?

I have some useful methods for physics calculations like acceleration / deceleration, speed, and some more. Most of them require at least two measurements asunder in terms of time. So every time I want to use them, I have to implement a bunch of instance variables in my object that needs the calculation, for example for calculating an a...

viewDidLoad gets called, viewWillAppear does not get called, view does not appear on screen.

Update It has been mentioned that viewWillAppear and viewDidAppear do not get called per the docs. However, I perform no initialization within these methods and no adding UI elements to the view. I was just using them to place break points to try to debug this. Any other ideas? Original Question I'm stumped. I'm refactoring some c...

UITableViewCell / UISegmentedControl border issue

I'm trying to get a UISegmentedControl in a group UITableViewCell much like in the wifi settings in the Setting Application. The problem I'm having is I'm getting a double border. I get one border for the UISegmentedControl and one for the UITableViewCell. I'm guessing I need to remove the border from the UITableViewCell. How can I go a...

What's the easiest way of using SQLite3 in iPhone-OS?

I've heard that it's a bad idea to use plain SQLite3 in an iPhone project. Which frameworks, libs, wrappers, etc. do you use? Which are worth looking at? ...

Ist it a good idea to use NSUserDefaults to store the latest state of an iPhone application?

I have an view-based application where the user can do a lot of customization things, like selecting colors, selecting pictures, and so on. First, I thought about using sqlite3 for that, but since this would result in a table with only one row (no multi-user app), it seems like a big overhead to me. Then I heard about NSUserDefaults. Bu...

NSUserDefaults: What's the +resetStandardUserDefaults method good for? How can I provide "system settings"?

I want the user to be able to make some preferences like colors, prefered images, etc. When I use NSUserDefaults for this, on first start of the app there will be no preferences, right? So, every time I want to get a preference like NSInteger avatarID = (NSInteger)[[NSUserDefaults standardUserDefaults] objectForKey:@"avatar"]; I have t...

How can I reset the NSUserDefaults data in the iPhone simulator?

I've added NSUserDefault data retrieval to my app, which is pretty nice. But for testing I would like to reset all the data I added to the defaults database, so that everything is in the state when the user launches the app the first time. I tried to call: [NSUserDefaults resetStandardUserDefaults]; but that doesn't do anything. The d...

How can I detect if the user just wanted to scroll, and not tap on an UIImageView inside a UIScrollView?

I've implemented an UIScrollView which contains a grid of UIImageView objects. For both, the superview and it's subviews, userInteractionEnabled is YES. As the user scrolls and his/her finger touches an UIImageView, it imediately recognizes a tap on that, which is not what I want ;) Inside of that UIImageView objects I have this method:...

How can I make a view that's managed with an Tab Bar fade smoothly in/out rather than flashing hardly in/out?

I have an Tab Bar controller and a nice tab bar on the bottom of my app. There are three buttons. When I tap one, then the view controller from that tab bar is "invoked" and the new view appears immediately. That's like banging a door very hard, so that everyone in the neighbourhood can hear it. I would like to have a softer transition, ...

How can I add CGPoint objects to an NSArray the easy way?

I have about 50 CGPoint objects that describe something like a "path", and I want to add them to an NSArray. It's going to be a method that will just return the corresponding CGPoint for an given index. I don't want to create 50 variables like p1 = ...; p2 = ..., and so on. Is there an easy way that would let me to define those points "i...

Is there a way to put a scalar type like CGPoint (or any self created) into a NSArray?

Probably I could create a class that holds an CGPoint as instance variable, like a wrapper. Does that make sense? I feel uncomfortable with that, though. I hope there is an better solution. How about any self-created scalar type? Like MyCoolScalarType? ...

How can I programmatically determine if an "touchUpInside" event occured?

It seems like if this method will be called any time the user touches my view: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; if ([touch view] == self && [touch tapCount] >= 1) { // do something... } } I've implemented this in an UIScrollView. The documentation...

UITableViewCell: How to prevent blue selection background w/o borking isSelected property?

I have a custom UITableViewCell subclass. I have set the contentView of my cell subclass to a custom UIView class in which i am overriding -drawRect: and doing all of the drawing there. Also, I am setting cell.contentView.opaque = NO in order to achieve transparency in certain areas of the cell (unfortunately, a backgroud image behind...

How can I programmatically determine CPU usage rate or how busy / occupied the system is in iPhone-OS?

My app is doing some pretty but heavy weight core animations during scrolling. Sometimes it crashes due to bad performance. So I need some way to find out if there is enough capability to make the animations, and if not, I just leave them away. Best way would be if I could ask the system how busy it is. UPDATE: I mean especially Core An...

Are there any tools or good techniques to find out where the performance bottlenecks are in an iPhone application?

I have an app that's half way done. The performance is not really good, and I wonder where the bottlenecks are. Although I can go ahead and start commenting out suspected lines of code, I wonder if there are any tools that would tell me which method cool took how long and what happened next. The stack trace isn't really that helpful. I ...

Are there easy functions for converting hours to seconds, seconds to hours, etc.?

I want to write some functions for that, but before I do: Are there any to convert between time units? ...

How can I securely free up memory by removing UIImageViews from the screen?

I have some UIImageViews that are nested in UIViews, which group them together. They're owned by an view controller. As soon as the -viewWillDisappear method is called, I want to remove those UIImageViews with their UIViews alltogether, so that the memory gets freed up. I call -release on the UIViews that contain the UIImageViews as sub...

How can I add an boolean value to an NSDictionary?

Well, for integers I would use NSNumber. But YES and NO aren't objects, I guess. A.f.a.i.k. I can only add objects to an NSDictionary, right? I couldn't find any wrapper class for booleans. Is there any? ...