objective-c

UITextField border color

Hello! Could anybody tell me the truth :) I have really great wish to set my own color to UITextField border. But I could find possibility to change the border line style only. Please, i'll wait any answer ...

How do i set placeholder char(%)?

In Objective-c ... I want represent placeholder char(%) but my code don't.... NSString *base = @"<style type=\"test/css\">div{width:100\%}</style><body>%@</body>"; NSString *html = [NSString stringWithFormat:base, @"hello world"]; NSLog(@"%@",html); expect : div{width:100%} real : div{width:100} what is wrong? ...

iPhone reachability checking

I've found several examples of code to do what I want (check for reachability), but none of it seems to be exact enough to be of use to me. I can't figure out why this doesn't want to play nice. I have the reachability.h/m in my project, I'm doing #import <SystemConfiguration/SystemConfiguration.h> And I have the framework added. I a...

Send programatic email through Objective-C

In an iPhone app I'm developing, I need to send an email programmatically (read, not allowing the user to see where the email is going) similar to the PHP mail() function. Is there a way to do that? Thanks in advance. ...

gdb works from command line, but not from script

If I execute each line of this script in console gdb it works as expected (except for detach hanging, but I can work around that.) However, if I save it to a script file and run gdb with the -x option it hangs on the [Visor install] line. It would be nice to know why it's doing this, or even just a hacky workaround for it. The script: ...

Can a NSDictionary take in NSSet as key?

I know you can use any object as key for NSDictionary but the problem is will it be able to retrieve the correct value? Support I have an entry where the key = {1,3,5} and value = { @"hello" }. Will I be able to retrieve from this dictionary entry by passing in the set {3,5,1}? In order words, is the key matched based on the pointer or...

How to unit tests functions which return results asyncronously in XCode?

I have something like - (void)getData:(SomeParameter*)param { // Remotely call out for data returned asynchronously // returns data via a delegate method } - (void)handleDataDelegateMethod:(NSData*)data { // Handle returned data } I want to write a unit test for this, how can I do something better than NSData* returnedDat...

C pointers vs. Objective-C pointers

Hello! I'm coming from an Objective-C background and am trying to expand my knowledge in C. One thing has me confused, however, and that's the difference between pointers in C and Obj-C. As you can see in the examples below, things seem to behave a bit differently between both languages, and I was wondering if you could help explain w...

converting NSString to precise number for performSelector: afterDelay:

I am communicating with a webservice to retrieve a numerical value that comes into my function as an NSString. This number tells me the precise amount of time to wait until I perform another action, and it is critical that it be precise. As an example, if the string is "89283", then this means I must wait 89.283 seconds. So I'd like...

How do I deal with typing nested message calls in ObjC source from only the keyboard?

I think over the last year and a half, while experimenting with Cocoa and Cocoa Touch development, I've been struggling with getting Xcode to support a kind of key macro to handle this specific coding scenario... I frequently find myself not knowing ahead of time how many message dispatches to chain together while typing a new line of c...

UIButton with UIButtonTypeCustom animation bug

So there seems to be an issue with animating size transformations for UIButtons. Specifically, if you have a button of type UIButtonTypeCustom, any frame size transformations happen instantly. Movement and other animations happen as normal. Does anyone have a good fix for this? I'm guessing that it's because the custom buttons contai...

SubViews not properly initialized using IB

I'm having trouble getting my SubViews properly initialized using Interface Builder. I have the following View hierarchy (UIWindow -> BlankCanvasView -> StalkerView). BlankCanvasView is a subclass of UIView and StalkerView is a IBOutlet of BlankCanvasView @interface BlankCanvasView : UIView { IBOutlet UIView *stalker; } @end I've...

Cocoa: Any downside to using NSSet as key in NSMutableDictionary?

Is there any downside to using NSSet as key in NSMutableDictionary, any gotchas to be aware of, any huge performance hits? I think keys are copied in Cocoa containers, does it mean NSSet is copied to dictionary? Or is there some optimization that retains the NSSet in this case? Related to http://stackoverflow.com/questions/1863061/can-...

Forcing Consecutive Animations with CABasicAnimation

I have a notification that fires in my model when certain properties change. As a result, a selector in a particular view object catches the notifications to change the position of the view accordingly. The notifications causes a view on the window to move in a particular direction (always vertically or horizontally and always by a sta...

UIPickerView with Multiline UILabel

I'm currently working on a program that populates a picker view dynamically from my Core Data set up. I have everything working data-wise but the problem i'm running into now is formatting on my labels. The picker is presented with it's own toolbar in an actionsheet with a button on the right side of the toolbar. It's initial state is ...

crop image from certain portion of screen in iphone programmatically

Hello, NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; CGSize contextSize=CGSizeMake(320,400); UIGraphicsBeginImageContext(self.view.bounds.size); UIGraphicsBeginImageContext(contextSize); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *savedImg = UIGraphicsGetImageFromCurrentImageContext(); UIGr...

Calling base class functions through derived pointers

( Objective C ) How would I call a base class function using a derived pointer where foo is overridden in the derived class. Essentially the equivalent of this C++ code base* b_ptr = 0 ; derived* d_ptr = new derived() ; d->base::foo() ; I would think this should be fairly simple. Do I need to use a selector? ...

Concatenating two NSStrings separated by a CRLF

Sorry for the dumb question. I have two NSStrings and I want to create a third that is the first string plus a new line plus the second string. I know this must be easy but I am banging my head looking for it. Ultimately I want the resulting string to display correctly in a table view cell. Regards Dave ...

How to load video from remote server in iphone?

I want to play a video from a remote server and not from youtube. The video should start streaming in the in built video player of the iphone. Can anyone help me with this..... Thanx in advance ...

"Private methods" or static functions in Objective-C. Which one should I use?

When reading Best way to define private methods for a class in Objective-C I end up with a programming style doubt. Which is the better solution (in terms of style) to this problem? To use a category and declare it in the @interface directive in the .m file or go with the static function that receives an object. Thanks ...