objective-c

UIScrollView not scrolling when set to a tableView's tableHeaderView

Hey everyone, I'm having difficulty scrolling a UIScrollView instance in my UITableView when I set it as a tableHeaderView. It still responds to touch events it appears, but doesn't wish to scroll horizontally. I've tried explicitly setting to setUserInteractionEnabled:YES without much luck. Is there something in particular I need to...

Is it better to only use float instead of mixing float and int in an large calculation?

I have a pretty large formula that has to be calculated about 300 times per second. Most of my variables are float, but some variables are just parameters that go into that formula. In some cases, float is not needed. I could use int parameters. But I wonder if mixing int and float types in an calculation would cause the system to cast t...

Is there a better shortcut for "move to next suggestion" in Xcode

In Xcode, if I type nsmut then escape, I'm offered a number of NSMutable suggestions (NSMutableArray, NSMutableSet, etc). I use the arrow keys to get the one I want. This forces me to take my fingers off the home keys. I was wondering if there's another keyboard shortcut to select the next and previous selection in the dropdown menu th...

With an NSArray of object references, do I explicitly release all objects in the array or just the array itself?

My class has an NSArray that is filled with objects. In my dealloc method, can I simply call release on my NSArray, or do I need to iterate the array and release all objects first? ...

sqllite3 prepare insert query in iphone programming

(BOOL) addticket { NSString *event=@"max"; NSString *venue=@"tvm"; sqlite3 *database; databaseName = @"smbhDB.sql"; sqlite3_stmt *addStatement ; NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDir = [documentPaths objectAtIndex:0]; ...

NSURLConnection is run many times

I connect asynchronously with server each 5 seconds. The URL is the same, but POST-body is changed each time. Now I create NSURL, NSURLRequest and NSURLConnection from the scratch each time. I think it'd be more effective to set connection once and just use that one further. I am a newbie and not sure if that possible. There is no muta...

Store an encryption key in Keychain while application installation process

I need my application to use client's phone-number to generate unique ID for my web-service. Of course a phone-number is unique, but it must be secured. So it can be implemented with symmetric encryption (asymmetric will be later, because leak of resources), but I do not know where to store a encryption-key. 1. I do not know why, but s...

retriving integer value from the UITextField into a NSInteger variable.

UITextField *textField; NSInteger intRollNumber; I want to take rollNumber as input from the textField and store the value into intRollNumber . How i do that? Because I am unable to convert the string into integer. ...

What's the most optimal way to get a random floatingpoint number between floatA and floatB?

I have an interval consisting of two float numbers, and need to generate 20 random numbers in a look that are somewhere inbetween this interval defined by the two floats. Lets say, for example: float a = 12.49953f float b = 39.11234f float r = //best way to get best randomly numbers between a and b The random number may be == a and =...

What's the easiest way of implementing own functions that are used all over the place in an large project?

I want to create a set of functions, that make life easier. I use them in about 60% of all project files. I wonder what's the most efficient way of including these in the project. I think about creating one file where they go in and including this file in every file where I need them. On the other hand, it would be cool if I can include...

How do I create a file that only contains functions in objective-c?

I want to make a file that contains useful functions for my project. Well, I know that I can define a function inside my class implementation. But I don't really get it... I mean: I don't want to create a "class", just functions. Or are functions always part of a class? My objective-c knowledge is pretty limited, and my nice big book on ...

Does it matter if there are unused functions I put into a big CoolFunctions.h / CoolFunctions.m file that's included everywhere in my project?

I want to create a big file for all cool functions I find somehow reusable and useful, and put them all into that single file. Well, for the beginning I don't have many, so it's not worth thinking much about making several files, I guess. I would use pragma marks to separate them visually. But the question: Would those unused methods bo...

Get text of button from IBAction - iPhone

When an IBAction is called: -(IBAction) onClick1: (id) sender; What is passed in the sender? Since it's hooked up through the IB, I'm not really sure. My question is how to get the text of the button to be the passed object (NSString most likely) so that I could call it inside the action implementation. -(IBAction) onClick1: (id) s...

What do I have to imagine when thinking about an "Library" in objective-c?

For me, a library is a collection of classes that do useful things. Typically something, that can be useful in a lot of projects. Is that also the case in terms of objective-c? What exactly is a library there? Only classes that have methods? Or also collections of functions? And do they have to be compiled to be called a "library"? Where...

How can I get a precise time, for example in milliseconds in objective-c?

Is there an easy way to get a time very precisely? I need to calculate some delays between method calls. More particular, I want to calculate the speed of scrolling in an UIScrollView. ...

Registration for Cocoa shareware

What is the best way to protect a Cocoa shareware application from software piracy? Are there developer libraries/tools out there for this task? ...

Need/want to pass an NSError** as an argument to performSelector

I want to invoke a selector of a method that has the usual NSError** argument: -(int) getItemsSince:(NSDate *)when dataSelector:(SEL)getDataSelector error:(NSError**)outError { NSArray *data = nil; if([service respondsToSelector:getDataSelector]) { data = [service performSelector:getDataSelector withObject:when withObje...

UIScrollView

Hi All, I am using UIScrollView for zooming an image. While to zoom out the image i want it to be put on double tap. So my question is can it be possible to zoom out zoomed image on double tap. (i am able to detect the double tap on zoomed view). Which property we can use for this of Scroll View. Thanks in advance. Regards, Vishal ...

What kind of logarithm functions / methods are available in objective-c / cocoa-touch?

I've tried searching for logarithm + objective-c, but all I get is math test pages from teachers, or explanations what a logarithm is ;) I've got some measurements that are like 83912.41234 and others are 32.94232. I need to press down this huge spectrum into something between 0 and 100, and that 32.94232 would habe to be at least somet...

How do I terminate a thread waiting on @synchronized objective C

Hey there, I have some code like this: doDatabaseFetch { ... @synchronized(self) { ... } } and many objects that call doDatabaseFetch as the user uses the view. My problem is, I have an operation (navigate to the next view) that also requires a database fetch. My problem is that it hits the same synchronize block and ...