objective-c

Set a breakpoint condition for self pointer in Mac OS X

I'm trying to figure out when [NSView setNeedsDisplay] is called for a particular object. I want to set a breakpoint on it that fires only when the self pointer refers to the object I care about. The method is called probably hundreds of times around the time it's called for my object, so something like a breakpoint condition is necessar...

how to change image when clicked on tableview cell iphone

i have a tableview. i add image to the cells when clicked on the cell in didselectrow method by using cell.conteview addsubview. but the problem is if i click on 1st cell it changes the image and when i click on another cell image will appears but the old image is not removed from the previous cell. This is happening for all cells in tab...

iPhone, how can I store / load one value on a simple table view settings screen?

Heres my cellForRowAtIndexPath where I've loading a value for a row, instead of a value from a simple array and converting it to a row. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusabl...

printing to a dot matrix printer on a mac

So i am designing an art project that will print to a dot matrix printer the contents of my internet history. i have found info online to parse out a plist (what os x uses to store internet history) so im all set on that front but what i am looking to find out is how to send a request to the printer to print a new line, which would happe...

Tint all UIBarButtonItems in my App (MFMailComposer, etc)

I created a custom Navbar for my application using a protocoll: @implementation UINavigationBar (CustomImage) - (void)drawRect:(CGRect)rect { UIImage *image = [UIImage imageNamed: @"navbar.png"]; [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; } @end this works fine. all toolbars in my app...

How to deal with character Encoding in Obj-C ?

Hi, I'm a new to Obj-C (my experience is in Java and a little C) I have this project these days, which is An Arabic-Text encryption .. I need to read an arabic text file (character by character), but when I want to use these characters and store them in variables (of type char) I couldn't .. it gives me this warning "Multi-character cha...

How to create an NSImage from an NSView that isn't completely visible?

I have an NSView in an NSScrollView that I want to create an NSImage from. Because it's in an NSScrollView it's not always completely visible, and it can be even bigger that the screen's size. Can anyone help me? Thanks. ...

calling a method that changes nib properties using detachNewThreadSelector

I' m calling doSaveItems: like [NSThread detachNewThreadSelector:@selector(doSaveItems:) toTarget:self withObject:aObject]; doSaveItems: method has a code that references to one of my Outlets: [uiProgressLedIdle setHidden:YES]; of course I'm setting an autorelease pool inside this method. The problem is that [uiProgressLedIdle setH...

Menu Options are not changing - cocoa

I am making a cocoa app where i have a menu - you can see the picture below - but the problem is when i click on any other option e.g; subtract, multiply or division, it don't get selected. What can be the issue? Note: When i made the menu, i checked the state option of add to ON and rest of them were OFF. ...

Retrieve data from a plain file (Iphone development)

In my personal of Iphone development project I need to retrieve data from plain txt file, afterwards using delimiter to separate data in the way I want. It's my sample data: 100 100, 200 200, 300 300, 400 400 So how to retrieve data from myfile.txt and later retrieve the string "100 100" from this chunk of data? ...

How do i modify a UILabel's properties when my MyViewController is unarchived from a nib?

I am currently creating my first app for a personal project and I'm having trouble modifying a UILabel's properties when MyViewController is loaded. From other tutorials, I see that when the nib for my app is unarchived, the initWithCoder app is called: @synthesize tipText; //references the UILabel i created in my nib file - (id)initW...

XCode: Cannot change target membership for folders

I have a number of folders in my Resources group. I want to include some of them in target A and some in target B. To this end I created two subfolders: Resources - content -- A -- B If I try to change target membership for 'content' I can, under 'Get Info', select the targets. If I try the same for 'A' and 'B', under the 'Targets'...

How to insert a subview with xib?

Hello! I'm confused something fierce over having multiple views. I simply want to have a button on my main view that activates a new view, which in turn would have an (x) button which goes back to main view. For the life of me, I can't figure out how to do this with two separate .xib files. How might this be done? Thanks! ...

iPhone Recalculate Scroller Content Height?

I am adding a bunch of boxes into a UIView inside of a UIScrollerView. The content of the UIView goes beyond the bottom of the device's screen and should cause the whole scene to scroll. However, this isn't happening. The content gets added but the scene will not scroll. I assume it has to do with UIKit not automatically resizing the UI...

Content types understood by an application

Given an application path (or NSBundle to an application, etc), is there a way to easily/efficiently determine what content types that application can open? My initial attempt was to read the application's Info.plist file and extract the content types listed under the kUTExportedTypeDeclarationsKey key. However, there are some flaws wi...

Importing from Photoshop

Hi all, is it possible to import a merged picture from photoshop using scripting bridge and use it as an NSImage? ...

How Can I Iterate an ARGB Bitmap?

Hi to all. I am a bit confused. I have an ARGB bitmap into an unsigned char* array and I just want to iterate the array to check if pixels are black or white. Can anyone post me a sample code for this? To get the array I am using this methods. CGContextRef CreateARGBBitmapContext (CGSize size) { CGColorSpaceRef colorSpace = CGCol...

When using autorelease, when is it actually released?

Sometimes I wonder when something gets autoreleased. I added an NSLog in the dealloc of various objects, but I couldn't find anything useful. When does something release when autorelease is used? Is it unpredictable, or is there some extra thread running? Thanks. ...

when is the right time to reloadData

I have a DetailsViewController class and an ItemsViewController class. (Both derived from UITableViewController) Selecting any of the items in the ItemsViewController brings up the DetailsViewController. In order to get it to show the new data on any but the first one, I currently have - (void)viewWillAppear:(BOOL)animated { [s...

Mac app UDP data over its own IP

Is it possible for an objective-c mac app to send UDP data to its own IP address? If so, can someone show me an example? code? Thanks! ...