objective-c

Searching one array and displaying the value of another array at same index

Here is my plist: <dict> <key>ehindi</key> <string>ankamaal</string> <key>part</key> <string>n</string> <key>meaning</key> <string>hug</string> <key>hindi</key> <string>अंकमाल </string> </dict> Here is my code: - (void)viewDidLoad { [super viewDidLoad]; NSString *path = [[NSBundle mainBundle] bundlePath]; NSString...

objective-c release

Hi, I have this class in DNS.h @interface DNS : NSObject <NSXMLParserDelegate, NSNetServiceDelegate> { NSMutableArray *servsPublished; } @property(nonatomic, retain) NSMutableArray *servsPublished; Then in the implementation file DNS.m there's a method where I release it and I get the exec bad access memory error. This is metho...

how to initialize an object(NSObject subclass) at a specific address

Hi I need to initialize an NSObject at a particular location that I specify(through a void* pointer, for example). For a little bit of context, I am writing a sqlite3 aggregate function. To keep temporary results from this function, I have to call a sqlite3_aggregate_context function, which allocates a block of memory for me. I want to s...

What is the difference between compare: and isEqualToString:?

I was working on this: NSString *str1 = @"This is string A"; NSString *str2 = @"This is string B"; NSComparisonResult compareResult; if([str1 isEqualToString:str2] == YES) NSLog (@"str1 == str2"); else NSLog (@"str1 != str2"); compareResult = [str1 compare: str2]; if (compareResult == NSOrderedAscending) NSLog (@"str1 < ...

CGAffineTransformMakeScale Makes UIView Jump to Original Size before scale

I have a UIView that I set up to respond to pinch gestures and change its size, except, once you enlarge it and then try and pinch it again, it jumps to its original size (which just so happens to be 100x200). Here is the code: @implementation ChartAxisView - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame...

Remove all objects after index 20 in NSMutableDictionary?

Hi! I have an NSMutableDictionary that possibly contains more than twenty objects. If it contains more than 20 objects, how should I remove the oldest entries until there is only 20 left? For example, NSMutableDictionary with objects: a = "-1640531535"; b = 1013904226; c = "-626627309"; d = 2027808452; e = 387276917; f = "-1253254618"...

NSMutableArray initWithObjects Not Working

Ey guys, I am having some problems adding NSURLs to an array and looping through them. Here are the relevant portions of my code: RSS_ReaderAppDelegate.h: @interface RSS_ReaderAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; UINavigationController *navigationController; NSDictionary *RSSFeeds; NSMuta...

Cocoa Touch: How to add a subview that is centered horizontally in its parent view?

Hi, my subview (childView) has a smaller width than the parent view. [parentView addSubview:childView]; I'm wondering how I might be able to add this child centered horizontally (vertically I want it to remain the same) in the parent view. I'd like to do this in code. Right now it's adding but to the top left corner of the parent. an...

Iphone- How to resize view when call status bar is toggled?

Hello Guys, I'm creating an iphone app with few elements inside the controller (e.g tab bar, uiview, uitoolbar, etc..). Everything works fine until I encountered this problem. While my application is launched, I received a call and it shows the "Call Status Bar" which ruined the ui. Some elements are pushed down because the "Call Status...

Two Empty NSPopUpButtonCell Options On Load

Hi everyone, I have an NSTableView which represents a list of objects. One of the variables in the represented object is selected from a drop-down NSPopUpButtonCell (it's a cell because it's in the table view) - an NSArrayController which holds some NSManagedObjects. The "Selected Object" for the column (in IB) is bound to the array co...

Simple scaling on IPad

I'am trying to scale the UIImageView to the full screen on IPad,but its not happening.. :( i'm using CGRect frame to resize the image,but the image crosses the boundary of the IPad. :( I need dis to be completed plz guide me.. :( ...

Question with NSTextField

I have this code that changes the text of an NSTextField [TextField setStringValue: [PrinterCard print]]; (PrinterCard print returns an NSString) What I want to do now is I want to append the PrinterCard print string to the text of TextField. I also want to do this on the next line, so I want basically to append this: @"\n%@", [Prin...

Objective C: Properties error

Im getting some kind of error when setting a value to a NSArray property of my code. I will send you de code and the debugger output. @interface RootViewController : UITableViewController { @private NSArray* regioesArray; // NSString *str; // NSArray *ar; } @property(nonatomic, retain) NSArray *regioesArray; @implementation RootV...

When is the right time to release properties?

Hey guys, I have a couple of properties declared in my header file, and just wondering when they have to be released. I'm currently doing them in my "dealloc" method, but getting the EXC_BAD_ACCESS error when doing so. Here's my code @property (nonatomic, retain) NSTimer *timer; @property (nonatomic, retain) NSString *closeimage; @pr...

Proper way to represent time of day for alarms

I'm trying to code part of a program that allows users to set up one or more alarms that will remind them to launch the application and do something at certain times of day. I basically understand that I need to use local notifications, but I'm having a hard time coming up with the best way to represent a time of day in my application s...

Core Data Managed Entity Object Class usage Problem

Hi I have this application which is saving tweet messages from twitters public time line. For that I have created a "Tweet" entity in my model & has generated a managed object class from XCode. I have declared Tweet ivar in my controller class & have synthesized it but when I try to put some value in it like tweet.text = @"Some parse...

How to add a slide-up view with multiple buttons? Is there any ready-to-use component in Objective-c?

I want to add to my application a new view with buttons for sharing content or saving it to disk. I know how to do sharing itself (save, email), but I wonder if this layer should be created as frame or there is any ready-to-use class displaying modal ![alt text][1]layer for half screen? I prefer to ask before doing it manually. I'm not ...

Objective-C Block type as return value

How do I write the following: typedef void (^T)(void); T f() { return ^{}; } without the typedef? ...

[obj-c] Catching cases of missing self when setting ivars

Does anyone know of a decent way to catch forgetting to use 'self.' when setting variables? Is there an xcode compiler setting that can trigger warnings? I'm trying to think of the easiest way to make ensuring there is a 'self.' in front of assignments foolproof. ...

sqlite3_step return code 21 during loadView

Experimenting with sqlite, I want to init a list view with data from the DB. My source looks like this: -(void) initTheList { sqlite3 *db; int rows = 0; const char* dbFilePathUTF8 = [searchTermDBLocation UTF8String]; int dbrc = sqlite3_open( dbFilePathUTF8, &db ); // count if (dbrc) { NSLog( @"Could not open the DB" ); } else { ...