Friday, 10 May 2013

Posting an image in webview




HI Team,

Posting an image in web view..


 NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
 NSURL *bundleBaseURL = [NSURL fileURLWithPath: bundlePath];
    
  NSString *htmlString =  [NSString stringWithFormat:@"<html><head><style>body{background-color:transparent}p{font-family:arial;font-size:15px;color:black;}</style></head><body><p>%@</p></body></html>",[array objectAtIndex:0]];

[webview_obj loadHTMLString:htmlString baseURL:bundleBaseURL];

Note:baseUrl Should not be nil

Tuesday, 7 May 2013

Handling Multi Touches in iOS

HI Team,

For Disabling Multi Touch Functionality


 for(UIView* view1 in self.view.subviews)
    {
        if([view1 isKindOfClass:[UIButton class]])
        {
            UIButton* btn = (UIButton*)view1;
            [btn setExclusiveTouch:YES];
            
        }
    }

Monday, 6 May 2013

Handling the special symbols while retrieving from database

If you have any new characters(other than alphabets/other language) in your database and for retrieving the characters as it is into your project , you need to change the type of that entity as TEXT. If you set that type as TEXT in database ,then you can retrieve whatever symbols /characters present in the database.

If you got any unwanted special symbols in the database itself, you need to manually edit the database.

Handling unrelated animation issues

Hi all,

After setting the animations for a view,you need to commit the animations.

     [UIView beginAnimations:nil context:NULL];
     [UIView setAnimationDuration:0.3f];
     [UIView setAnimationDelegate:self];

     [UIView commitAnimations];

Otherwise those animations will be applied to all the next views so that the entire project will be effected by unrelated and unhandled animations.

Tuesday, 30 April 2013

Monday, 29 April 2013

Adding Animation for loading screen

Hi Team,
I am sharing the source code of adding animation for loading image when the application is being launched.


-(void)fadeSplashView{
    
    splashView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
    splashView.image = LOADINGIMAGE;
    splashView.animationImages = LOADINGIMAGES;
    splashView.animationDuration = 1;
    splashView.animationRepeatCount = -1;
    [splashView startAnimating];
    
    [self.window addSubview:splashView];
    [self.window bringSubviewToFront:splashView];
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:3];
    [UIView setAnimationDelay:0.5];
    [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.window cache:YES];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(removeSubView)];
    splashView.alpha = 0.0;
    [UIView commitAnimations];
    
    //Adding activity indicator on splash view
    UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    indicator.color = [UIColor blackColor];
    indicator.alpha = 1.0;
    indicator.center = CGPointMake(150, 390);
    indicator.hidesWhenStopped = NO;
    [splashView addSubview:indicator];
    [indicator startAnimating];
}

-(void)removeSubView{
    [splashView removeFromSuperview];
}

Create UIImageView object in your AppDelegate.h file and Call "FadeSplashView" method in your "didFinishLauching" method of your AppDelegate.m file.

Here, i have prepared a macro LOADINGIMAGES for array of images.
For array of images that are for animating the loading screen, you should prepare the images according to your loading image.

Please send the comments if you have any queries..
Thank you




Friday, 26 April 2013

How to send the Animated Image(.gif) thru Email in iOS?

Hi all,
     I want to post the animated image thru Email.But when I use the link of animated image, then  the image is animated in Email body.
I used below code for sending animated image (http://php.eminosoft.com/emoji/images/beautiful.gif is having the animated image).

Code:

 MFMailComposeViewController *mailView = [ [MFMailComposeViewController alloc]init];
  if([MFMailComposeViewController canSendMail])
  {
          mydata = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:http://php.eminosoft.com/emoji/images/beautiful.gif]]];
         [mailView setSubject:@"Emoji app"];
            
            [mailView addAttachmentData:mydata mimeType:@"image/gif" fileName:@"beautiful"];
           
            mailView.mailComposeDelegate = self;
            [self presentModalViewController:mailView animated:YES];
            [mydata release];
            [mailView release];


Is there any other ways to send the animated image with out using the link.

Thanks in Advance..