Friday, 22 March 2013

Hide or remove header from mobile web page in UIWebView

Deleteing web page header in mobile :
    

[webView stringByEvaluatingJavaScriptFromString:@"$(document).ready(function() { $('div.ui-header').remove(); })"];

This Code should write in the following Method.

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    [webView stringByEvaluatingJavaScriptFromString:@"$(document).ready(function() { $('div.ui-header').remove(); })"];  
}
After deleted Header only it will get load content in webpage.
This is usefull for hiding header in facebook,twitter and linkedin mobile web pages.



Wednesday, 9 May 2012

Playing the push notification sound file

First we should add the Sound files  to  bundle of the projects.Then we can create payload like this.

{"aps": {"alert": "hi", "sound": "attention.wav"}, "device_tokens": ["1E22FB4E50812D90F85EA9B6E93DB7A90643F09D07A86B0E4FB724CE04735C70"]}

Sound field file name should exist in application's bundle.

Wednesday, 11 April 2012

Address to Latitude and Longitude values, Latitude and Longitude to Address

Converting Address to Latitude and Longitude values:



http://maps.google.com/maps/geo?q=Your Address&output=csv

Converting Latitude and Longitude  to Address:

http://maps.google.com/maps/geo?q=17.499943,78.451407&output=csv





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];