目前,我正在撰写一部基于 Apple果的乐器,我想给它增加一条进步。
我怎么能够取得进展,以显示在我所期望的“静默”中正在玩的音乐的进展?
目前,我正在撰写一部基于 Apple果的乐器,我想给它增加一条进步。
我怎么能够取得进展,以显示在我所期望的“静默”中正在玩的音乐的进展?
This is how I accomplised this In the header file I declared these variables.
www.un.org/Depts/DGACM/index_spanish.htm
<编码> UISlider *timeSlider;
<代码>BOOL用户IsScrubbing;
- (IBAction)handleScrubber TouchDown (id)sender;
- (IBAction)handleScrubberTouchUp:id)sender;
- (IBAction)handleScrub(id)sender;
In the main file now under the viewDidLoad method, I ran an NSTimer
currentTimeUpdateTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(updateCurrentiPodItemTime) userInfo:NULL repeats:YES];
<代码>用户代码Scrubbing = NO;
之后,这是一个更新所有事项。
- (void)updateCurrentiPodItemTime {
MPMediaItem *nowPlayingItem = [self.musicPlayer nowPlayingItem];
if (nowPlayingItem == nil) {
self.minLabel.text = @"00:00";
} else {
NSNumber *duration = [nowPlayingItem valueForProperty:MPMediaItemPropertyPlaybackDuration];
double currentTime = self.musicPlayer.currentPlaybackTime;
self.minLabel.text = [NSString stringWithFormat: @"%02d:%02d", (int) currentTime / 60, (int) currentTime % 60];
self.maxLabel.text = [NSString stringWithFormat: @"%02d:%02d", [duration intValue] / 60, [duration intValue] % 60];
if (!userIsScrubbing)
self.timeSlider.value = (float) currentTime;
}
}
- (IBAction)handleScrubberTouchDown:(id)sender {
userIsScrubbing = YES;
}
- (IBAction)handleScrubberTouchUp:(id)sender {
userIsScrubbing = NO;
}
- (IBAction)handleScrub:(id)sender {
self.musicPlayer.currentPlaybackTime = timeSlider.value;
}
Add a timer to fire every second (1.0) and get it to call an method to update the progress bar like the one below:
- (void) updateProgressBar:(NSTimer *) timer {
if (currentPlaybackTime != lengthOfSong) {
[self.progressBar setValue:self.musicPlayer.currentTime];
}
else {
[timer invalidate], timer = nil;
[self.progressBar setValue:lengthOfSong];
}
}
Add a UIProgressView to your view and update it periodically.
For a basic app with nonconsumable in-app purchases, has anyone figured out best practices for using SKPaymentQueue s restoreCompletedTransactions? Observations I know it s recommended to always ...
I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...
I have a UITextField that is a subview of a UITableViewCell. When my view loads, I want the text field to become first responder. I have a pointer to the text field in the table cell, so to do this I ...
I ve been working on adding in-app purchases and was able to create and test in-app purchases using Store Kit (yay!). During testing, I exercised my app in a way which caused the app to crash mid ...
In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...
Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...
I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...
Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...