In my Objective-C project I have a Country class (NSManagedObject subclass). When comparing a country to another its important for me to know the total world population. I'm doing this operation a lot and it's getting expensive. I decided to put the population in a static variable of Country. However I want to initialize this value befor...
Hi all,
I try to draw an XY graph using GraphKit.
Information of this framework is very limited on the internet...
Here's what I did:
// a xychart is predefined in header as GRChart
GRDateSet *dataset = [[GRXYDataSet alloc] initWithOwnerChart:xychart];
[xychart addDataSet:dataSet loadData:YES];
[xychart reloaddata];
also I imple...
I have searched extensively and cannot for the life of me find any information about how to achieve a similar effect to that of the iTunes song title scrolling if the text is too large in Cocoa. I have tried setting the bounds on a NSTextField to no avail. I have tried using NSTextView as well as various attempts at using NSScrollView. ...
- (void)viewDidLoad
{
[super viewDidLoad];
page = 2;
NSString *pathToPdfDoc = [[NSBundle mainBundle] pathForResource:@"2010_07" ofType:@"pdf"];
NSURL *pdfUrl = [NSURL fileURLWithPath:pathToPdfDoc];
myDocumentRef = CGPDFDocumentCreateWithURL((CFURLRef)pdfUrl);
CGRect pageRect = CGRectIntegral(CGPDFPageG...
In an iPhone app I'm developing, I grab a set of data from a web service, store it in a mutable array for showing in a table, and also store it in core data as backup when there is no network.
My array is initialized in application:didFinishLaunchingWithOptions: as follows
tableArray = [[NSMutableArray alloc] initWithCapacity:100];
the ...
Hey all!
What I'm trying to do is convert an EKEvent into NSData, and then convert it back into an EKEvent.
I looked around and noticed that in order to use NSKeyedArchiver, the class must conform to the NSCoding protocol. I also found that if I was creating a custom class, I could make it conform to the NSCoding protocol by implementi...
I essentially want to give each instance of a class a unique id.
So, I created a static integer. I increment it each time a new object is created and then assign the value of the static variable to an ivar. But clearly I don't understand something because, let's say I create three objects, "thisPageNumber" (which is the instance variabl...
I have read here -- without understanding much -- that it's bad to use mod range. So this typical recommendation for Objective-C
int r = arc4random() % 45;
might be a bad idea to get a number from 0 to 45 (something about the distribution and this formula having a preference for low bits). What should one use in Objective-C?
<sarc...
It it possible for objective c to compile xml data (aiml files for example)??
I'm looking for it to compile AIML files then be able to "chat" with the files using objective c. Is there a XMLView or something??? Any ideas??
Elijah
...
I have an ObjC object defined as follows
@interface Fruit : NSObject
{
int fruitsinbranch[4];
}
@property (readonly) int fruitsinbranch[4];
@end
And then in the implementations I have the usual
@synthesize fruitsinbranch[4];
It does not work. What's the right way of doing it?
(And no, I am not asking for other ways to do stuff...
Hey everyone,
I'm a complete noob at objective-C, so this might be a very silly question to a lot of you.
Currently, I have a view with a 'SignIn' button, which when clicked, activates a sigupUp IBAction that I have defined below. Basically, this method needs to make a JSON call and get back some data about the user.
So, right now, my...
Trying to update an fetched object and getting 'unrecognized selector sent to instance' error whenever I try and set any property on the object, here is my code:
NSFetchRequest *request = [[NSFetchRequest alloc]init];
NSEntityDescription *entities = [NSEntityDescription entityForName:@"PurchaseOrderItem" inManagedObjectContext:managedOb...
I've written a macro in Objective-C to perform a safe cast. Here's what it looks like so far:
#define SAFE_CAST(OBJECT, TYPE) ([OBJECT isKindOfClass:[TYPE class]] ? (TYPE *) OBJECT: nil)
This works really well, but it'd be nice if there was a way to store OBJECT in a variable so it didn't get called twice. For instance, using the ma...
I want to use a widget just like size or attributes buttons of Inspector view of Interface Builder, but I found in Library view , no one widget will be found? which widget it used?Thank you very much!
...
Hello,
Is there any way i can get the path of the image on a particular person on the address book.? Im trying to copy the image on a person and load it into a table view. Im thinking it would be much faster if i just copy the path of the image instead and use the path on the table view.
...
I am downloading images in table view cells as they scroll onto the screen. For UX reasons, I start downloading the images in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath. I do not wait until the table view is done scrolling. When the table view cell is set, I start downloading i...
Hi all,
Really hoping someone can help me sort out why sending objects that are members of an array seems to be the hardest thing in the world in Obj-C.
Here's the setup: I have a car class. Car has two member objects, engine and tire (of which there are four). Then I have an NSArray (also a member of car) initialized to hold the tire ...
I need to send encrypted data to a remote server from Objective-C using a web service. What encryption method should I use? It should support both Objective-C and the remote server.
...
I am developing a "doodle jump" like game and i have 5 platforms on the screen on at a time. there are two background UIImageViews. I have the "scrollUp" function called whenever the player is in the top 3/4's of the screen. when the backgrounds are in view, the game slows down and lags, when the backgrounds are out of view (have scolle...
Hi
How to add/access hyperlinks (both internal and web page) in the PDF in iphone?
Sri
...