How to use varargs….

      No Comments on How to use varargs….

Hi Ever wondered how we give multiple button names in alert view other buttons section…and in many more scenarios.. Ok so how we define a function with varargs.. -(void)getMultipleString:(NSString*)firstString ,… NS_REQUIRES_NIL_TERMINATION; Now the definition -(void)getMultipleString:(NSString*)firstString ,… NS_REQUIRES_NIL_TERMINATION { va_list  t; va_start(t, firstString); id obj; for (obj = firstString; obj !=… Read more »

Xcode upgrade: PBXContainerItemProxy missing containerPortal key

the project icon which we see i.e projectname.xcodeproj, is actually a directory, you do this 1. in terminal do cd yourproject.xcodeproj2.ls3.vi project.pbxproj4. scroll down till /* Begin PBXContainerItemProxy section */5.there you will see all sections check for the section which is missing a portal key edit it and save it… Read more »

iOS6 attributed string usage code snippets

      No Comments on iOS6 attributed string usage code snippets

  Fun starts Now   infoString=@”This is an example of Attributed String”; NSMutableAttributedString *attString=[[NSMutableAttributedString alloc] initWithString:infoString]; NSInteger _stringLength=[infoString length]; UIColor *_black=[UIColor blackColor]; UIFont *font=[UIFont fontWithName:@”Helvetica-Bold” size:30.0f]; [attString addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, _stringLength)]; [attString addAttribute:NSForegroundColorAttributeName value:_black range:NSMakeRange(0, _stringLength)]; //——————————————————————————————– UIColor *_red=[UIColor redColor]; UIFont *font=[UIFont fontWithName:@”Helvetica-Bold” size:72.0f]; [attString addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, _stringLength)]; [attString… Read more »

How to change the Alpha Of an image

      No Comments on How to change the Alpha Of an image

+ (UIImage *) setImage:(UIImage *)image withAlpha:(CGFloat)alpha{ // Create a pixel buffer in an easy to use format CGImageRef imageRef = [image CGImage]; NSUInteger width = CGImageGetWidth(imageRef); NSUInteger height = CGImageGetHeight(imageRef); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); UInt8 * m_PixelBuf = malloc(sizeof(UInt8) * height * width * 4); NSUInteger bytesPerPixel = 4; NSUInteger… Read more »

How to remove selected string between parenthesis in xcode

Hi if you got a string which contains comment between some special characters then you can use – (NSString *)stringFilter:(NSString *)targetString {          NSScanner *theScanner;     NSString *text = nil;          theScanner = [NSScanner scannerWithString: targetString];          while ([theScanner isAtEnd] ==… Read more »