Custom Calender For iPad


Hi,

I have implemented Custom Calender Control for iPad which is bit simple to implement.

Step 1: Add the Listed File into your Project.(I have Provided  all Listed Files.)

1.CustomCalendar.h

2.CustomCalendar.m

3.CustomCalendar.xib

4.TdCalendarView.h

4.TdCalendarView.m

Step 2: Now your 70% Task is completed.You need to Integrate the Delegate Methods only.

#pragma mark – CalendarViewDelegate methods
-(void)monthChanged:(CFGregorianDate)currentMonth viewLeftTop:(CGPoint)viewLeftTop height:(float)height{

}
-(void)selectDateChanged:(CFGregorianDate)selectDate{
}

-(void)beforeMonthChange:(TdCalendarView *)calendarView willto:(CFGregorianDate)currentMonth{

}

For More info Please check this images.

Here i am attaching the sample code for the same.

Advertisements

How to Integrate iAd in your Application?


Hi,

Today I am going to discuss how apple iAd is integrated in our iPhone/iPad Native Application.It’s really a very simple task.I am dividing this task in 3 simple steps.

Step 1:

1.import iAd Framework to the Application.

2.Provide #import <iAd/iAd.h> in the particular controller where you want to show your Add.

3.Provide it’s delegate UIViewController <ADBannerViewDelegate>

4.Provide one  view to that particular ViewController.Assume I have taken

@property (weak, nonatomic) IBOutlet UIView *contentView;

Step 2:

Allocate it in ViewDidLoad method

– (void)viewDidLoad
{
_bannerView = [[ADBannerView alloc] init];
_bannerView.delegate = self;

[super viewDidLoad];
[self.view addSubview:_bannerView];
}

step 3:

Provides it’s delegate methods which i have mention bellowed.

– (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) {
_bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
} else {
_bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;
}
[self layoutAnimated:duration > 0.0];
}

– (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
[self layoutAnimated:YES];
}

– (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
[self layoutAnimated:YES];
}

– (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave
{

return YES;
}

– (void)bannerViewActionDidFinish:(ADBannerView *)banner
{

}
– (void)layoutAnimated:(BOOL)animated
{
if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation)) {
_bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
} else {
_bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;
}

CGRect contentFrame = self.view.bounds;
CGRect bannerFrame = _bannerView.frame;
if (_bannerView.bannerLoaded) {
contentFrame.size.height -= _bannerView.frame.size.height;
bannerFrame.origin.y = contentFrame.size.height;
} else {
bannerFrame.origin.y = contentFrame.size.height;
}

[UIView animateWithDuration:animated ? 0.25 : 0.0 animations:^{
self.contentView.frame = contentFrame;
[self.contentView layoutIfNeeded];
_bannerView.frame = bannerFrame;
}];
}

and your Advertisement is ready.

You can take the source code from Here.

(In File Option click on Download Original)

How to restrict user for only IntegerValue in UITextfield for iPad/iPhone?


Hi,

There are some situations where we required that User should input only numeric value like 0to9.In that kind of situation we have to use this tricks with UITextField’s delegate method.

– (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string  {

NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];

[numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle];

NSNumber* candidateNumber;

NSString* candidateString = [textField.text stringByReplacingCharactersInRange:range withString:string];

range = NSMakeRange(0, [candidateString length]);

[numberFormatter getObjectValue:&candidateNumber forString:candidateString range:&range error:nil];

if (([candidateString length] > 0) && (candidateNumber == nil || range.length < [candidateString length]))

{

return NO;

}

else

{

return YES;

}

}

Day-14 for iOS development


Click here for Lecture 14 which includes

1.UIImagePickerController( Getting still photos or video from the user either from camera or photo library)

2. MPMovie[View]PlayerController   ( How to play videos )

3. ALAssetsLibrary   (How to store images or videos in the user’s photo album)

4. Sounds  ( How to play simple sounds and record simple audio snippets)