I need to keep datetime in a C++ structure for an iPhone app. The time will be saved and restored into sqlite db. What is the best data type and corresponding API for this?
My candidates are:
time_t and struct tm from <ctime> and <time.h>
NSTimeInterval from <NSDate.h>
TimeValue from the QuickTime API
My instinct is to go with the g...
I set maxlength to my textField, when I entered maximum characters in the textField the backspace is not working. Due to that I am unable to change the textFields content.
This happens when I test my application on iPhone sdk 3.0 but it works properly in iPhone sdk 2.2.
Here is my code,
- (BOOL)textField:(UITextField *)txtField shoul...
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...
thing.h
@interface Thing : NSObject
{
float stuff[30];
}
@property float stuff;
@end
thing.m
@implementation Thing
@synthesize stuff;
@end
I get error: type of property 'stuff' does not match type of ivar 'stuff'
I don't want to use an NSArray because I'd have to make the floats into NSNumbers (right?) and that's a pain to ...
Actually I want to stop the timer of one view when I go on next view, so what can i do?
That means when I open one view the timer is start , when I come to next view the timer is still running. Plz help me for that.
...
These two collection types are rarely used by me as I'm typically using their counter parts, NSArray, NSDictionary and the equivalent mutables. I have a feeling I'm missing out on a collection which can act much faster than the other two in certain situations. When is the ideal time to use these and how?
...
Is there a way to preset UISlider values to something such as:
100, 121, 10000, 40505, 100000, 460322, 1000024, 5005230, etc...
The numbers don't have a pattern. As the user moves the slider, I'd like to display the above numbers as corresponding to where the user is on the slider. The slider displays numbers in specific increments a...
Hello,
I've looked at this over and over again and I can't see the problem. Its probably obvious and I'm probably being an idiot and I apologize in advance for this.
In my interface I have:
@interface PolygonShape : NSObject
{
int numberOfSides;
int minimumNumberOfSides;
int maximumNumberOfSides;
}
@property int numbe...
Hi everyone,
I have several dataSources I use for one UIViewController. My view controller uses KeyValue Observing in order to follow the state of certain properties at runtime. When I swap dataSources, I need to stop observing those properties. The problem is, I'm not sure of the class of the dataSource at runtime, therefor something l...
Hi,
How can I set the background color of a cell in UITableView?
Thanks.
...
How do I test if an NSString is empty in Objective C?
...
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...
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...
Hi!
I'm trying to create a custom UIButton that should look like a UIButtonTypeRoundedRect. In my drawRect:, I'm creating a path with first one call to CGContextMoveToPoint() and then four calls to CGContextAddArc(). I then stroke the path. However, in the resulting image the four rounded corners are clearly thicker than the rest of the...
My understanding is that protocols are like interfaces in other languages -- they declare expected methods -- while categories allow you to add new methods to existing types (perhaps even types you don't own.)
Why, then, does the iPhone SDK sometimes use categories for declaring delegate types? Normally I would expect all delegates to b...
Hello,
I'm currently populating model objects into an NSSet (perhaps I should be using NSCountedSet). The models should be unique. What I do is pull them in from a web service, and then instantiate them on the client-side and add them to a set.
My problem is the following: There are times when I'll only pull one model and add it to the...
Hi all,
I currently have one UITableViewController that contains many cells with simple data in it. When the UITableViewController instantiates a UITableViewCell, it begins running a background thread for each individual cell to get its state from the server. The UITableViewCell is subclassed and already has a UIImageView property that ...
I have a very straight forward class with mostly NSString type properties. In it, I wrote a trivial implementation of the description method. I found that whenever I try to include "self" in the description, it crashes my iPhone app. An example is something such as the following:
- (NSString *)description
{
NSString *result;
re...
How to convert NSString value to NSData..
thanks and regards
...
Hi
I am debugging my application on iphone (OS 2.0) using X-code 3.1 iphone SDK 3.0 beta 5 . My application crashes giving message
* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray insertObject:atIndex:]: index (8) beyond bounds (8)'
2009-05-23 17:13:32.304 myApp[405:5a07] Stack: (
808163835,
...