Wednesday, 16 July 2014

Blog for Angular JS


Hi Team,

Follow this blog , basic things can know to implement Angular JS

http://techiedreams.com

Monday, 21 April 2014

Adding left padding to the UITextField, when add background Image


 Adding left padding to the UITextField, when add background Image


#import "QuartzCore/QuartzCore.h"  
  // First import this Framework
......

UITextField *commentTextField = [[UITextField alloc]initWithFrame:CGRectMake(40825034)];
    commentTextField.delegate = self;
    commentTextField.placeholder = @"Comment";
    [commentTextField setFont:[UIFont boldSystemFontOfSize:12]];
    commentTextField.textAlignment = UITextAlignmentLeft;
    commentTextField.leftView = [[UIView allocinitWithFrame:CGRectMake(001220)];
    commentTextField.leftViewMode = UITextFieldViewModeAlways;
    commentTextField.background = [[UIImage imageNamed:@"textBox.png"stretchableImageWithLeftCapWidth:7topCapHeight:17];
    [self.view addSubview: commentTextField];

Wednesday, 16 April 2014

IOS 7 AVPlayer - AVPlayerItem duration incorrect in iOS 7


AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:movieURL];
CMTime duration = playerItem.durationfloat seconds = CMTimeGetSeconds(duration);
NSLog(@"duration: %.2f", seconds);
This worked fine with iOS 6 but with iOS 7 for some reason it returns NaN. When inspecting  playerItem.duration the CMTime object has 0's with a flag of 17.
But player works fine, just the duration is wrong.
So over come this problem Please import these frameworks.
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import <MediaPlayer/MediaPlayer.h>
#import <CoreMedia/CoreMedia.h>
#import <AVFoundation/AVAsset.h>

In place of above code you can paste this code:AVURLAsset *asset = [AVURLAsset assetWithURL: movieURL];Float64 duration = CMTimeGetSeconds(asset.duration);NSLog(@"duration..%f", duration);

Thursday, 10 April 2014

Disable ARC for a Single file in a project in iOS

Disable ARC for individual files by adding the -fno-objc-arc compiler flag for those files.

You add compiler flags in Targets -> Build Phases -> Compile Sources. You have to double click on the right column of the row under Compiler Flags.

xcode

Sunday, 2 February 2014

UITextfield's size change when enter large text

Hi,
In my app I have multiple textFields. When I enter small text than it will work fine, but when large text is entered than UITextField size changed.

Without Text:

       
                                                                                                       
With Small Text:






With Larger Text:   The textfield size also increased with respect to text .









I tried this one for overcoming the issue. but i don't have any change while using this one.

[yourTextField setAdjustsFontSizeToFitWidth:FALSE];

Thursday, 23 January 2014

Hi all,

Can anyone please let me know how to delete an image ( a Blob element ) from the sqlite database in iOS?

Thanks in Advance
Tejaswini.S


Monday, 6 January 2014

How to avoid user authentication in Dropbox API?

Here is the solution.....

Use HTTP API instead of Native API to generate the access Tokens (Which we can use for authorization)

Follow the below link to Generate OAuth_Tokens

http://oauth.net/core/1.0/#auth_step1

The following are the steps to generate Access tokens


RequestToken : oauth_consumer_key =xxxxxxxxxx(APP Key)&oauth_signature(APP SECRET KEY)=xxxxxxxxxxx
timeStamp = current time in seconds
Nonce =  Any random string


https://api.dropbox.com/1/oauth/request_token?oauth_consumer_key= xxxxxxxxxx&oauth_signature_method=PLAINTEXT&oauth_signature= xxxxxxxxxx%26&oauth_timestamp=1388707200&oauth_nonce=jdiwdj39rndkk&oauth_version=1.0



You will get oauth_token & Oauth_Secret now

Now signIn to dropbox account to Authorize the request token

Authorize: https://www.dropbox.com/1/oauth/authorize?oauth_token=xxxxxxxxx

Now you will get the Access token

AccessToken :


https://www.dropbox.com/1/oauth/access_token?oauth_consumer_key=xxxxxxxx&oauth_token= xxxxxxxx&oauth_signature_method=PLAINTEXT&oauth_signature= xxxxxxxx%26 xxxxxxxx&oauth_timestamp=1388707400&oauth_nonce=dji430srgsmx33448&oauth_version=1.0



reply
oauth_token_secret = xxxxxxxx & oauth_token = xxxxxxxx & uid=124926213
Now you have access tokens to access your dropbox with out using user authentications



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.

Tuesday, 26 November 2013

How to create the Test User apple developer account to test the InApp purchase concept

Hi,

  Follow the below link and follow the steps they have mentioned

https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/7_ManagingYourTeam/ManagingYourTeam.html

Friday, 22 November 2013

How to declare a variable which we need to use inside a block?

You must use the __block specifier when you modify a variable inside a block, so change your code to this:
 __block NSString *textString;
 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 
                                                 (unsigned long)NULL), ^(void) {
      textString = [self getTextString];
});
Blocks capture the state of the variables declared inside, so we must declare that the variable is mutable. And mutability is exactly what you need considering that you're essentially setting this thing.

Wednesday, 20 November 2013

Customise the UITextField clearButton colour:




change the color of a UITextField clearButton:




CGFloat myWidth = 25.0f;
    CGFloat myHeight = 25.0f;
    UIButton *myButton = [[UIButton alloc] initWithFrame:CGRectMake(0.0f, 0.0f, myWidth, myHeight)];
    [myButton setImage:[UIImage imageNamed:@"close"] forState:UIControlStateNormal];
    [myButton setImage:[UIImage imageNamed:@"close"] forState:UIControlStateHighlighted];
    
    [myButton addTarget:self action:@selector(doClear:) forControlEvents:UIControlEventTouchUpInside];
    
    myTextField.rightView = myButton;
    myTextField.rightViewMode = UITextFieldViewModeUnlessEditing;

Tuesday, 19 November 2013

Change UITextField’s placeholder color without subclassing it


Change UITextField’s placeholder color without subclassing it

The safe way to customize UITextField’s placeholder is subclassing theUITextField and overriding placeholderRectForBounds:, Apple won’t bother you on this one. However, if you want to take the risk, you can try this way:

[self.MyTextField  setValue: [UIColor darkGrayColor]  
                                 forKeyPath: @"_placeholderLabel.textColor"];

Thanks 
R.Anusha