Posts

iOS: Adding rounded corners in a layer

Image
    CALayer *layer = roundedFrameView. layer ;     layer. cornerRadius = 8.0f ;     layer. borderColor = [[ UIColor colorWithRed : 0.89 green : 0.89 blue : 0.98 alpha : 1 ] CGColor ];     layer. borderWidth = 0.8 ; The RGB color above will render a light gray color which is ideal for a rounded frame. Check out my screen shot below. You notice the frame where it covers the string "The Item is list as "On Sale"..." is being framed.

iOS: Using CGColorRef to use an RGB color to add drop shadow

    //CGColorRef pixelColor = [[UIColor redColor] CGColor];     // UIColor* color = [UIColor colorWithCGColor:pixelColor];       CGColorRef*  aqua = [UIColor colorWithRed:0.521569 green:0.768627 blue:0.254902 alpha:1] CGColor];                 layer. masksToBounds = NO ;     layer. shadowRadius = 1.0f ;     layer. shadowOpacity = 0.5f ;     layer. shadowColor = aqua; //  ( __bridge   CGColorRef )([ UIColor   grayColor ]); // use bridge when it's not a CGColorRef type     layer. shadowOffset = CGSizeMake ( 4.0f , 5.0f );     layer. shouldRasterize = YES ;     layer. borderWidth = 0.8 ;

iOS: Adding a drop shadow in an image

You can just modify the x,y and width and height values inside the CGRectMake to make adjustments for your object's relative coordinates and you can also adjust as well the radius, opacity and offset of the shadow. Make sure your self.contentView is the view where your image is shown, and take note that your image must be added after the shadow, not before the shadow so it'll be behind the image. By adding an image, just do after the code above somewhat like, self.imageView =  [[ UIImageView alloc ] initWithImage :[ UIImage   imageNamed : @"CellImageTest.png" ]]; [ self . contentView addSubview : self . imageView ];

iOS: Forcing orientation in your view controller (iOS 6 and iOS < 6)

Got this trouble on forcing the app to be in a a landscape mode. Let say, you have a standard orientation of a Portrait but at first force the view controller to be in landscape where the button is located in the left side. So I have this code that you can try, play, and modify. See below, // //  MainViewController.h @interface MainViewController : UIViewController <UIWebViewDelegate> @end // MainViewController.m #import "MainViewController.h" @implementation UINavigationController ( autorotation ) // >= iOS 6 - ( BOOL ) shouldAutorotate {         UIInterfaceOrientation interfaceOrientation = [ UIApplication sharedApplication ] .statusBarOrientation;     NSLog ( @ "intefaceorientation: %d" , interfaceOrientation ) ;     [ self.topViewController shouldAutorotate ] ;     return YES ;     } // >= iOS 6 - ( NSU...

Where in Mac OS X 10.8 does your backup iOS apps(*.ipa files) are stored?

In case you're wondering where the heck these apps are being stored. I just found this inside this directory, $HOME/Music/iTunes/iTunes\ Music/Mobile Applications  Where your $HOME is the shell environment defined variable like /Users/geeko. Hope this does helps.

TCP vs UDP

I wanted to make this notes into my blog so I won't go afar from my blog when people asked me the different of these two. From  http://www.diffen.com/difference/TCP_vs_UDP

iOS/Objective-C: Use "oneway" keyword for asynchronous call on methods and usage of in, out, byref, bycopy keywords

Just encountered this "oneway" keyword in iOS when I was trying to implement a Singleton Pattern. So here is the example, - ( oneway void ) release ; -(oneway void) giveMeAnObjectWhenAvailable:(bycopy out id *)anObject; The use of "oneway" keyword above simply tells that, it is asynchronous (the result is not immediately expected) - hence it must return void . It is used with the distributed objects API, which allows use of objective-c objects between different threads or applications. It tells the system that it should not block the calling thread until the method returns. Without it, the caller will block, even though the method's return type is void. Obviously, it is never used with anything other than void, as doing so would mean the method returns something, but the caller doesn't get it. For clarification on the second method above, keywords " bycopy " and " out " simply means that, bycopy - parameter is transmitted ...