objective-c

Is there anything like SHA1CryptoServiceProvider (Which is C#) in Objective-C?

I am trying to create a serial number checker in an app that I am writing, and it uses cryptography to encode the name and entered number against what it actually should be. I am familiar with the SHA1CryptoServiceProvider used in C#, but is there anything like this in Objective-C? Here is sample code from C# that I want to convert to...

How to shuffle button or title over button?

I have 'n' button. I want to shuffle those button in my application. Or you can say that i want to shuffle the title over buttons. Is it possible.Its an Iphone app. ...

NSCFString or UIViewController !?

Hello, I am using UIViewController (a subclass of course) with a text field which sends an action when the contents changed (to the contentsChanged: selector of the ViewController). It is done by sending contentsChanged: to file's owner in IB. But when I test it, it says : "-[NSCFString contentsChanged:] : unrecognised selector sent to i...

How to read the content of a pdf file in iphone

Hello Sir, Are you able to fetch the content of pdf file . I am trying to do the same , i had spend a lot of time on it , i don't get any solution, can you give me some solution . Thanks, Dinesh Thakur ...

Dynamically generated property/function call in objective C

Is it possible to dynamically build a property or function call? I have a set of views I want to render in the same manner. So if part of my code is like this self.ViewName.hidden = NO; and I want to use a variable for the name of the view, is there a way to do it, something like self{var}.hidden = NO; Where 'var' is a NSString of t...

can I reference a subview by its index?

I display a modal view controller and from there use buttons to add subviews. I need to add other view controllers as subviews, and then remove the one behind it. So can I reference the views by their index? Practical example: User sees page 1 (The root view controller) User presses button which adds a subview, page 2. User presses ano...

Alternate code in objective of java

recently i have switched from Android to iPhone.....could any one let me know what is the alternete code in Objective c...Thankx in Advance etName = (EditText) findViewById(R.id.etName); name = etName.getText().toString(); ...

Why is stringValue failing here?

I'm trying to bring data into my app from an external file. everything's working until I add the event.title (the 3rd objectAtIndex below). I think I'm incorrectly using "stringValue" and it should be something else. the floatValues work fine. event.latitude = [[values objectAtIndex:0] floatValue]; event.longitude = [[values objectAtIn...

Printing a specific NSRect from an NSView subclass

I'm working on trying to get my NSView subclass to print nicely, but I'm having trouble figuring out custom pagination. My problem is this: only a portion of my NSView subclass contains data worth printing, so I've written a function - (NSRect)printableBounds to get the rect within the NSView that I want to print. I want to print only th...

Creating an NSImage from bitmap data

Ok, it appears that the I'm creating a PDFDocument where pixelWidth is incorrect in the images that I created. So the question becomes: How do I get the correct resolution into the image? I start with bitmap data from a scanner. I'm doing this: CGDataProviderRef provider= CGDataProviderCreateWithData(NULL (UInt8*)data, bytesPerRow * le...

nested view controllers, where to add subview and how to manage memory

I have one root viewcontroller loaded by app delegate and a second one (no nib file) that should be loaded as root controller's child (i want to display its view contained in root controller's view). Where and how should i do this? Is viewDidLoad method suitable for such initialization? - (void)viewDidLoad { MyViewController* pdfCont...

Problem with setting a value

Here is my code snippit: - (void) getData: (NSNotification *)aNotification{ NSData *data = [[aNotification userInfo] objectForKey:NSFileHandleNotificationDataItem]; if ([data length]) { return [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]; } else { [self stopProcess]; } [[aNotification objec...

\n not working in UIlabel

Hi guys, I've seen similar questions here, but still can figure out why it's not working. How to add line break (in other words add new paragraph) in multiline UIlabel? I have a label with a lot of text, lbl.numberOfLines = 0; lbl.sizeToFit; but I'm still getting something like this: "Some text here\nAnd here I want new line" Thank...

objective c "say" command

In applescript there is a say command. Is there something like this for objective c? Thanks, Elijah ...

Why does this random number sometimes get set to -1?

Every now and again, the following comes out as -1 int randomIndex = random() % [directionsArray count] - 1; The init method for this class is where directionsArray is created and srand() is called. It looks like this - (id) initSprite { if ( ( self = [super initSprite] ) ) { speed = 1; directionsArray = [[NSArr...

Weird mod behavior in Obj. C

I have the following code: NSInteger index1 = (stop.timeIndex - 1); //This will be -1 index1 = index1 % [stop.schedule count]; // [stop.schedule count] = 33 So I have the expression -1 % 33. This should give me 32, but is instead giving me 3... I've double checked the values in the debugger. Does anyone have any ideas? ...

NSImage -> PDFPage -> NSImage how do I mantain resolution?

I have a bunch of NSImages that I'm keeping in a PDFDocument, as PDFPages. When I insert the NSImage the first time, the size of the NSImage is in points (72 dpi), and the size of the (only) NSImageRep is in pixels (200 dpi). However, the NSImage that I get out of the PDFPage has 72 dpi for both image AND imagerep. How do I recover my...

UISearchBar:textDidChange: return value when empty?

Hi, does anyone know how to test when the last character in a UISearchBar is deleted. i.e. you type ... Gary > return "Gary" Gar > return "Gar" Ga > return "Ga" G > return "G" > return ??? . -(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { [self FG_Filter:searchText]; } I was thinking ...

How to perform an action after a moving UIImage reaches a specific point

i am trying out a pong game to start out developing games on the the iphone and i've got everything moving but i need to implement the scoring and make the ball return to the center of the screen this is the code i have currently in the touchesBegan method: if(ball.center.y >=444) { computerScore=computerScore+1; compute...

How to safely remove objects from NSMutableSet (cocos2d-iphone)

Hello. I'm rather new to serious programming, so please forgive my dumbness, but I've failed to figure this out by myself. I am writing a game with cocos2d-iphone. I have a scene object with several NSMutableSets in its ivars - units, buildings, rockets, etc. I have a problem removing objects from these NSMutableSets. When a bullet obj...