Wednesday, 21 March 2012

Showing UIButton title in multiple lines


myButton.titleLabel.textAlignment = UITextAlignmentCenter;
myButton.titleLabel.lineBreakMode = UILineBreakModeCharacterWrap;
[myButton setTitle:@"Please\nTouch" forState:UIControlStateNormal];

Tuesday, 20 March 2012

Custom animation while push view controller


    CATransition* transition = [CATransition animation];
    transition.duration = 0.6;
    transition.type = kCATransitionFade;
    transition.subtype = kCATransitionFade;
    [self.navigationController.view.layer addAnimation:transition
                                                forKey:kCATransition];
    MenuViewContoller *postingVC = [[MenuViewContoller alloc] init];
    [self.navigationController pushViewController:postingVC animated:NO];
    [postingVC release];

Friday, 9 March 2012

SMTP custom message formate


        NSDictionary *plainPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/html",kSKPSMTPPartContentTypeKey,
                                   [NSString stringWithFormat:@"<h1>Ask Us</h1><h2>Get the Answers You Need Now!</h2><b>Thank you for giving us your review</b><br/>"]
                                   ,kSKPSMTPPartMessageKey,@"8bit",kSKPSMTPPartContentTransferEncodingKey,nil];

        test_smtp_message.parts = [NSArray arrayWithObjects:plainPart, nil]; //vcfPart
        [test_smtp_message send];

Sunday, 4 March 2012

Solving Time Difference problem with GMT


                    NSDate *resultDate = [format dateFromString:strDate];

                    NSTimeZone* sourceTimeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
                    NSTimeZone* destinationTimeZone = [NSTimeZone systemTimeZone];
                    
                    NSInteger sourceGMTOffset = [sourceTimeZone secondsFromGMTForDate:resultDate];
                    NSInteger destinationGMTOffset = [destinationTimeZone secondsFromGMTForDate:resultDate];
                    NSTimeInterval interval = destinationGMTOffset - sourceGMTOffset;
                    
                    NSDate* destinationDate = [[[NSDate alloc] initWithTimeInterval:interval sinceDate:resultDate] autorelease];
                    [format setDateFormat:@"MMM dd yyyy, HH:mm"];
                    NSString *strResultDate = [format stringFromDate:destinationDate];