Sunday 15 December 2013

How to limit Zooming in of an image upto a particular frame?

Hi all,

Can anybody let me know how to limit the zoom out functionality upto a particular frame?
Beyond that frame , the image should not be zoomed out.


Thanks in advance
Tejaswini.S

Thursday 12 December 2013

Applying touch events to UIScrollview

How can I detect touch points in my UIScrollView ? The touches delegate methods are not working.


Ans:

For this we need to set up a tap gesture.

UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapGestureCaptured:)];

[scrollView addGestureRecognizer:singleTap];   
 

and you will get the touches in:

- (void)singleTapGestureCaptured:(UITapGestureRecognizer *)gesture
  {

    CGPoint touchPoint=[gesture locationInView:scrollView];
  }

Tuesday 10 December 2013

How to resolve the iOS: Warning: Attempt to present on while a presentation is in progress

I am trying to create a modal view controller after picking an image from the image picker. I use the code :


- (void)imagePickerController:(UIImagePickerController *)picker1 didFinishPickingMediaWithInfo:(NSDictionary *)info 

{
  UIImage *img = [info objectForKey:@"UIImagePickerControllerOriginalImage"];

 [myPicker dismissViewControllerAnimated:YES ];

 myImagePicker = [[ImagePickerViewController alloc] initWithNibName:@"ImagePickerViewController" bundle:nil];
   
myImagePicker.modalTransitionStyle  = 
         UIModalTransitionStyleCrossDissolve;
[self presentViewController:myImagePicker animated:YES completion:nil];
    
}

I receive the warning:
Warning:  Attempt to Present <Modal View Controller: 0x7561600> on <ViewController: 0x75a72e0 > while a presentation is in progress!


and the modal view does not appear.





Here the issue is happening because, we are first dismissing the UIImagePicker and immediately we are displaying another view as modal view. That's why we are getting this error.
So, the solution is the method with the completion handler.
- (void)imagePickerController:(UIImagePickerController *)picker1 didFinishPickingMediaWithInfo:(NSDictionary *)info {
    
    UIImage *img = [info objectForKey:@"UIImagePickerControllerOriginalImage"];

    [self dismissViewControllerAnimated:YES completion:^{
        
   myImagePicker = [[ImagePickerViewController alloc] initWithNibName:@"ImagePickerViewController" bundle:nil];
        
   myImagePicker.modalTransitionStyle  = UIModalTransitionStyleCrossDissolve;
        [self presentViewController:myImagePicker animated:YES completion:nil];

    }];
   
}





Wednesday 4 December 2013

How can we get the comments of video on googlePlus in ios ?

Hi ,


In my application i shared the video on googlePlus using Google+ API  and i need to get the comments of that video.
Is it possible to get the comments of video from googlePlus.
I gone through the GooglePlus API documentation and i found one link (https://www.googleapis.com/plus/v1/activities/activityId/comments
to get the comments.
but in that link we need t place the activityId.
When we share the video on googlePlus then one activityId is generated for that video but iam unable to get that activityId.

How can we get the comments of video on googlePlus in Android?

I refered the Google plus api link fro comments

https://developers.google.com/+/api/latest/comments/list

In this link they are using "activityid" to get the comments of respective videos.We are unable to get the activity id .Can you please tell me the suggetions or any links

Tuesday 3 December 2013

How to change table view height according to the content size?

For changing the table view height according to the content size


- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
   
    CGRect frame = self.listOfSets.frame;
    frame.size = self.listOfSets.contentSize;

self.listOfSets.frameCGRectMake 
                        (self.listOfSets.frame.origin.x ,  
                         self.view.frame.size.height
                     
                   (self.listOfSets.contentSize.height+80),
                    self.listOfSets.contentSize.width
                    self.listOfSets.contentSize.height);
   
}

Accessing subviews of a subview

For accessing individual buttons (subviews) of a main view depending on its tag,


 UIView *v = [self.view viewWithTag:k];
        if ([v isKindOfClass:[UIButton class]])
        {
            [v setAlpha:1.0];
        }

But if are having a hierarchy like, 
self.view -> scrollview-> buttons,
for accessing those buttons,

 UIView *v = [self.favScrollView viewWithTag:k];
        if ([v isKindOfClass:[UIButton class]])
        {
            [v setAlpha:1.0];
        }

here buttons are direct subviews for scrollview instead of main view.



How can we get the comments of video on googlePlus in ios ?


Hi ,


In my application i shared the video on googlePlus using Google+ API  and i need to get the comments of that video.
Is it possible to get the comments of video from googlePlus.
I gone through the GooglePlus API documentation and i found one link (https://www.googleapis.com/plus/v1/activities/activityId/comments)
to get the comments.
but in that link we need t place the activityId.
When we share the video on googlePlus then one activityId is generated for that video but iam unable to get that activityId.