Tag: objective c

Objective-C: alloc of object within init of another object (memory management)

In my .h file I have: NSMutableArray *myArray; @property (nonatomic, retain) NSMutableArray *myArray; My .m file looks basically like this: @synthesize myArray; – (id) init { self = [super init]; if (self != nil) { self.myArray = …. ? // here I want to create an empty array } return self; } – (void) dealloc […]

How Do I Do Distributed Objects on OSX with Objective C?

As of 2016, the Apple docs on this are stale and don’t work. For instance, they mention “retain”, but in XCode 7.1 the default is to use ARC and it doesn’t support “retain”. I tried various examples on the web and none worked. How do I code the IPC mechanism called Distributed Objects on OSX, […]

Naming convention for iPhone 5 images?

I am working on an app that would be for iPhone 5 and lower. for images I am using this code CGRect mainFrame = [[UIScreen mainScreen] bounds]; int imgIndex = arc4random() % 10 + 1; if(mainFrame.size.height > 480) [pBackgroundImageView setImage:[UIImage imageNamed:[NSString stringWithFormat:@”dreams 1136×640 %d.jpg”,imgIndex]]]; else [pBackgroundImageView setImage:[UIImage imageNamed:[NSString stringWithFormat:@”dreams_960x640_%d.jpg”,imgIndex]]]; but I am not satisfied with […]

connect button to TableViewController in xcode

I have a button in my view controller and I want to connect my button to table view controller (It means that when I click on button it loads and brings my table) but I don’t know how should I do that(I can connect my button to another view controller but not to the table […]

Add backslash to String in Objective-c

I have a problem identical to this problem here. I even want to encode the same infromation as him (it’s a date/time for asp.net)… When ever I try to add a backslash i get two backslashes since I used \. Everyone in the thread above has claimed that this is a problem with NSLog and […]

Objective C: How to kill a thread while in another thread in Objective-C?

I was trying to set up a multi thread app. One of the threads is working as background to get some data transfer. Right now this thread automatically kill itself after it’s job done. Somehow I need to kill this thread in another thread in order stop its job immediately. Are there any api or […]

Keeping dictionary keys of JSON Object in order in Objective C

I’m using the JSON-FRAMEWORK in objective C to parse a JSON object. When I call [jsonString JSONValue], I get back a dictionary, but the keys aren’t in the same order as the JSON Object I’m parsing. Is there anyway to keep this order the same?

Asterisk in parenthesis in Objective-C… What does it mean?

Just a quick question from an Objective-C beginner: what does the asterisk in the parenthesis mean in the following sample code? Is it a pointer? Thanks in advance. #import <Foundation/Foundation.h> @interface Tire : NSObject @end @implementation Tire – (NSString *) description { return (@”I am a tire.”); } @end

Printing without UIPrintInteractionController

i am developing a POS(point of sale)application.i am able to print successfully with the UIPrintInteractionController popover. however , when a printticket button is pressed on the screen it should directly print without having the print interaction popover. i am not sure if this can be possible. can anyone suggest an alternative? Thank You.

Fetching image From Animating UIImageView

I’m using animation method of for implementing slide show in UIimageView as: mainSlideShowImageView.animationImages=images; mainSlideShowImageView.animationDuration = 75.00; mainSlideShowImageView.animationRepeatCount = 0; //infinite [mainSlideShowImageView startAnimating]; Now, what I want is to know which image is currently on image view screen. How can I do so? If it is not possible please tell that too. Edit: ‘images’ here is […]