objective-c

I want close a CFSocket

Hi, I have create a socket with CFSocket. My program is correct but now i wanna close the socket (client side). There is a istruction? Thanks and sorry for my English XP My code: CFSocketRef s; s = CFSocketCreate( NULL, PF_INET, SOCK_STREAM, IPPROTO_TCP, kCFSocketDataCallBack, AcceptD...

Layering Cocoa WebView - Drawing on top?

http://stackoverflow.com/questions/1618498/webview-in-core-animation-layer The only other thread I can find is the above which doesn't necessarily fit my needs. Is there a reliable way to simply draw a view on top of a webview? I've tried to layer a regular NSView on top of WebView, and it draws right at first, but any movement in the w...

Dynamically create sprite images for Cocos2d-iPhone

Hey guys, I'm working on a platformer, and looking for a way to create a sprite for an arbitrarily sized platform. For example, I may know I have a platform that should appear 200 pixels wide by 32 pixels high, and, say, I have a texture of bricks that I can tile to fill that area. I may also want to draw a black border around the platf...

Creating a window from a menu item

I would like three menu items on the menubar with the keyboard shortcuts cmd-1, cmd-2, cmd-3. This I know how to do. Each menu item would open up a different window (win1, win2, win3). I want it so that only one instance of each window is permitted to be open at any one time (i.e. only one win1, one win2, etc). How is this best approa...

How do I handle memory warnings when generating UIImages from PDF files in Objective-C?

When converting PDF Pages into UIImages I receive memory warnings all the time. It seems there is either some leak or something else that eats my memory. Using instruments didn't give me any helpful details. I'm using the following function to generate images from a pdf file: - (UIImage*)pdfImage:(NSString*)pdfFilename page:(int)page...

How to resolve CGDirectDisplayID changing issues on newer multi-GPU Apple laptops in Core Foundation/IO Kit?

In Mac OS X, every display gets a unique CGDirectDisplayID number assigned to it. You can use CGGetActiveDisplayList() or [NSScreen screens] to access them, among others. Per Apple's docs: A display ID can persist across processes and system reboot, and typically remains constant as long as certain display parameters do not ...

What is a safe way to check for a protocol response

Here's a scenario: A view controller pushes a new controller to the nav controller. This child controller creates a model that uses a NSURLConnection. When this connection finishes it will make a call like the following: [self.delegate modelDidFinishParsing:self]; What is the safe way to produce this code? Right now, I have this c...

commitAnimations is not resizing my UIImageView subview

I have created a UIView as a subview and to that subview I have added a UIImageView as a subview. UIView *viewCreated; UIButton *buttonCreated; UIImageView *imageViewCreated; CGRect myFrame = CGRectMake(0, 0, 1024, 1024); viewCreated = [[UIView alloc] initWithFrame:myFrame]; [viewCreated setTag:intTag]; viewCreated.backgroundColor = [UI...

What are advantages of adding views programmatically vs using InterfaceBuilder?

I've heard its simply a question of preference. But there must be advantages to adding views programmatically. Any experienced Xcoders care to comment? ...

How to generate a certificate signature on the iPhone?

Hi, If I had a private certificate file and a string on the iPhone, how do I use them to generate a signed string that can be verified by a server with the matching public key? What library should I use on the iPhone? ...

Chinese records of sqlite databse are in not accessable in iphone app

Hi! I'm creating an iphone app. In which I'm reading data from the sqlite db and presenting it in the tableview control. Problem is that the data is in chinese language. Due to unknown reason, when I read/fetch record from the sqlite table, some records are presented and other are missed by objc. Even objc reads some columns of the missi...

Are the following data type allocations analagous?

I'm very interested in languages and their underpinnings, and I'd like to pose this question to the community. Are the following analagous to eachother in these languages? C# Foo bar = default(Foo); //alloc bar = new Foo(); //init VB.NET Dim bar As Foo = Nothing 'alloc bar = New Foo() 'init Objective-C Foo* bar = [Foo alloc]; ...

Conditional column values in NSTableView?

I have an NSTableView that binds via an NSArrayController to an NSMutableArray. What's in the array are derived classes; the first few columns of the table are bound to properties that exist on the base class. That all works fine. Where I'm running into problem is a column that should only be populated if the row maps to one specific su...

NSDate & Memory management

Hi, memory management still gives me grief. This time it is an NSDate iVar that I init using NSDate *myNSDate = [[NSDate date] firstDayOfMonth]; with a method call to - (NSDate *)firstDayOfMonth { NSDateComponents *tmpDateComponents = [[NSCalendar currentCalendar] components:NSYearCale...

Flickr getrecent photo api with objectiveflickr

hi anyone know how to do api request for get recent photo from flickr ?, i'm still new to objective c, if anyone have tutorial or simple example to do it for iphone application that will be great. ...

test in-App purchase with Sandbox environment without itunes connection in iPhone

hi, I have some problem when i test In-App purchase,there is problem of iTunes connection,so i want to know that can we use sandbox Environment without itunes connection.Please help me out for this problem. Thnx ...

[[alloc] init] as a factory method

I want to initialize an instance of one of the subclasses of a superclass depending on the arguments to init: [[Vehicle alloc] initWithItinerary: shortWay]; // returns a bicycle [[Vehicle alloc] initWithItinerary: longWay]; // returns a car I can't find examples of code like this. I wonder if this is not idiomatic in Objective C, or ...

How to organize XIB files with many overlapping elements?

I have some XIB files which are very difficult to edit because many of the subviews overlap each other completely. For example, if I position a popup volume slider where it will pop up, it covers some UILabels which become impossible to click. My only chance to be able to edit them is to double-click on them in the Document window tree, ...

Using CGContext to display a sprite sheet iPhone

Hello, So I have a spritesheet in png format, and have already worked out the coordinates for what I want to display. I'm trying to create a method that will return a UIImage when passed the location information on the spritesheet. I'm just not sure how to use the CGContext stuff along with the the coordinates to return an UIImage. I ...

UITableViewCell select even doesn't work

I had a page control(UIPageControl) on a view (UIViewController) with table view (UITableView) on each page, each page have own table and can go to different view controller. i add the codes in "didSelectRowAtIndexPath" which can go to next level, is works perfect when i test it in a table view by itself, but it doesn't works when i have...