How to repeat a UILocalNotification Sound [closed] - iphone

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
How can I repeat a UILocalNotification sound?
-(IBAction) scheduleNotification1 {
local1 = [[UILocalNotification alloc] init];
// create date/time information
local1.fireDate = [NSDate dateWithTimeIntervalSinceNow:2];
local1.timeZone = [NSTimeZone defaultTimeZone];
// set notification details
local1.alertBody = #"2!";
local1.alertAction = #"View";
//local1.soundName = UILocalNotificationDefaultSoundName;
//local1.soundName = #"alarmsound.caf";
local1.soundName = #"29.mp3";
// set the badge on the app icon
local1.applicationIconBadgeNumber = 1;
// local1.repeatInterval =NSSecondCalendarUnit;//// NSMinuteCalendarUnit;
//local1.repeatInterval =1 ;
// Gather any custom data you need to save with the notification
NSDictionary *customInfo = [NSDictionary dictionaryWithObject:#"ABCD2" forKey:#"yourKey1"];
local1.userInfo = customInfo;
// Schedule it!
[[UIApplication sharedApplication] scheduleLocalNotification:local1];
//[local1 release];
}
Please provide some sample code.

Sorry a7mad, I am afraid to say that but it is not Possible to Repeat the sound of UILocal Notification.I hope you have checked Other Questions Of SO. All of them have Negative result.
I can give you a suggestion to Call an Alert View Or ActionSheet on Click of "View" Button of LocalNotification and Continue your actions on that Controller as they can be controlled...

Related

how to get selected image from PhotoAlbum and how can i save it in Application document directory? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
in my iOS application, how to get selected image from PhotoAlbum and how can i save it in Application document directory.
You can do it with the help of UIImagePickerController
-(void)showImagePicker
{
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
imagePicker.delegate = self;
[self presentModalViewController:imagePicker animated:YES];
}
Now Handle user's selected image with following delegate method
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *image = [info objectForKey:#"UIImagePickerControllerOriginalImage"];//Do whatever you want to do with your image.
}
For more clerity how things work please go through this tutorial
Hope this helps.

Set delay animation for UIPicker? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
If I have this code below to tell the UIPicker if nothing is selected to set the feet to 1, How can I delay this action a few seconds?
// If feet values are zero.
if (([feetPicker selectedRowInComponent:0] == 0 & [feetPicker selectedRowInComponent:1] == 0)){
// Set to one foot.
[feetPicker selectRow:1
inComponent:1
animated:YES];
}
[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:#selector(fireMethod) userInfo:nil repeats:NO];
The above code can be placed whenever you want to start the timer.
-(void)fireMethod {
// If feet values are zero.
if (([feetPicker selectedRowInComponent:0] == 0 & [feetPicker selectedRowInComponent:1] == 0)){
// Set to one foot.
[feetPicker selectRow:1
inComponent:1
animated:YES];
}
}

Audio recording with timer [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I want to take a photo and as soon as i do that, the audio should start recording automatically for say, 3 seconds.
Those 3 seconds should be counted down by a timer which appears on the left side of the screen, after the photo is taken.
So, then i have to combine the image and audio together and save it in a private directory.
Could someone tell me how do i do this by using the AVFoundation and Audio Toolbox frameworks?
I don't normally work with AVFoundation so I don't know the exact method/class names (I filled in my own), but a workaround to this would be having a recurring NSTimer beginning when the recording originally starts. Something like this:
#interface
int rec_time;
NSTimer *timer;
Recorder *recorder;
#end
#implementation
-(void)beginRecording {
[recorder startRecording];
timer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:#selector(recordingTime)
userInfo:nil
repeats:YES];
}
-(int)recordingTime {
if (rec_time >= 10) {
[recorder endRecording];
[timer invalidate];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"You recorded for too long!";
return;
}
rec_time = rec_time + 1;
}
#end
Also
AVAudioRecorder has the following method:
- (BOOL)recordForDuration:(NSTimeInterval)duration
I think that will do the trick!
http://developer.apple.com/library/ios/#documentation/AVFoundation/Reference/AVAudioRecorder_ClassReference/Reference/Reference.html#//apple_ref/doc/uid/TP40008238

Label adds up to players score at GameOver Scene: Objective-C [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
So I've seen it everywhere in apps/games and other things its when you score or you get game over and the score number adds up to your score from zero. I want it so in about 1 second a label goes from the text: 0 to and integer that is stored with the players score.
Create a UILabel to display the score, and use an NSTimer to update the UILabel's text property. Apple doesn't ship a class that will do it all for you.
You need two variables; the currentScore and the current score being displayed. You will also need a timer to handle updating the ui.
When your score changes, update currentScore to the final score you want. Then start a timer that increments the displayedScore until it gets there i.e.
-(void)scoreUpdater:(NSTimer *)timer {
// Update the score
displayScore ++;
[scoreLabel setText:[NSString stringWithFormat:#"%i", displayScore]];
// Have we got there yet?
if (displayScore == currentScore) {
[scoreTimer invalidate];
[scoreTimer release];
scoreTimer = nil;
}
}
I would go by using an NSOperation that sleeps and add the points (actually it may work even without sleeping). Something like:
NSInvocationOperation *op = [[NSInvocationOperation alloc] initWithTarget:self
selector:#selector(updateScore)
object:nil];
[queue addOperation:[op autorelease]];
-(void)updateScore {
while (tot < 1.0) {
displayingScore += score*incr;
tot += incr;
// update score label to displayingScore
[NSThread sleepForTimeInterval:0.05];
}
}

Admob Integration in iPhone [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
Could any one helpme with how to add admob codes in Appdelegate file.
Currently i have the following code in my appdelegate file.
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
[web_online loadHTMLString:#"<h1>Loading...</h1>" baseURL:nil];
current_word = [[NSString alloc] initWithString:#"keyword"];
current_url = [[NSString alloc] initWithString:#"http://www.google.com"];
#if 0
if ([[NSUserDefaults standardUserDefaults] boolForKey:#"auto_correction"] == NO)
search_main.autocorrectionType = UITextAutocorrectionTypeYes;
else
search_main.autocorrectionType = UITextAutocorrectionTypeNo;
#endif
//search_main.keyboardAppearance = UIKeyboardAppearanceAlert;
search_main.autocorrectionType = UITextAutocorrectionTypeNo;
search_main.autocapitalizationType = UITextAutocapitalizationTypeNone;
[self init_data];
[self init_sound];
[window addSubview:nav_main.view];
[window addSubview:view_start];
#ifdef DISABLE_ADMOB
view_ad.hidden = YES;
#endif
// Override point for customization after application launch
[window makeKeyAndVisible];
}
My question is how to add the admob codes ie the code below
bannerView_ = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
self.view.frame.size.height -
GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = #"67576511260";
// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:[GADRequest request]];
in the appdelegate file.
Everything else i have done.
All my code is done in appdelegate file . ie why this??
There's two questions to answer here.
Firstly, just put the code before the [window makeKeyAndVisible] replacing instances of [self view] with window and it should work.
Secondly, why is all that in your app delegate? The standard way of writing iPhone apps is to use a UIViewController with UIView objects (apple's variant on MVC) - this separates out your data and presentation code nicely.
More importantly here, all libraries like this will assume that you've used this pattern - hence you are finding trouble getting the admob code to work - it's designed to fit inside a UIViewController, not inside an app delegate.
Why have you decided not to use view controllers?