我正在尝试实现像倒计时器那样在0发出警报的东西.我希望能够设置在计时器关闭之前等待的时间,我想知道是否有提供的UI小部件或元素这种选择功能.
基本上,android有没有类似iPhone的选择旋转轮?或者是否有某种类型的时间戳可以选择任意数小时和分钟?android中的timepicker小部件有一个不必要的AM/PM标签.
我是否需要实现自己的自定义UI才能实现此目的?
我想在android中写一个倒计时,从3到0开始计数.就像前三个出现然后消失,2出现等等.我搜索了很多,但我找不到任何好的样本.你能帮我说明我该怎么办?
我希望从当前时间到特定日期倒计时,并在标签中显示该值.我查看了一些NSTimer教程,但我无法弄清楚如何将它们应用到我的情况中.
NSTimeInterval TimeInterval = [aString doubleValue];
NSDate* upperDate = [aDate dateByAddingTimeInterval:TimeInterval];
NSDate* Today = [NSDate date];
//cell.myLabel.text = here i should write a countdown.
Run Code Online (Sandbox Code Playgroud)
对不起代码不足.我经常尝试写一些自己的代码,然后在这里提问,但这次我无法想象要写什么.
编辑 因此,PartiallyFinite的答案,我想我如何设置计时器.但因为我使用tableview,我无法实现MyTimerLabel的重复消息.这就是我刚刚做的:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"MyCell";
MekanListesiViewCell *cell = (MyCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"MyCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
aClass *aC = [myArray objectAtIndex:indexPath.row];
NSTimeInterval TimeInterval = [aC.aTimeIntervalwithString doubleValue];
NSDate* UpperDate = [aC.aNSDate dateByAddingTimeInterval:TimeInterval];
NSDateFormatter …Run Code Online (Sandbox Code Playgroud) 我想在TextView中以类似[19:59]的格式显示计时器.所以当我点击开始按钮时,计时器将显示如下,例如,我想设置20分钟,它将显示为[19] :58] [19:87].谁能提出一些想法或示例代码?
我设置了我的计时器代码,它都是犹太洁食,但我希望我的标签显示"分钟:秒"而不是秒.
-(void)countDown{
time -= 1;
theTimer.text = [NSString stringWithFormat:@"%i", time];
if(time == 0)
{
[countDownTimer invalidate];
}
}
Run Code Online (Sandbox Code Playgroud)
我已经将"时间"设置为600或10分钟.但是,我希望显示屏显示10:59,10:58等,直到它达到零.
我该怎么做呢?
谢谢!
我已经搜索了Google上的这么多网站试图让它工作但是没有人似乎在任何地方都有这个,如果他们这样做只是不使用我的程序......我想要实现的是拥有一个玩家当玩家被击中时,他在第一次和第二次击中之间有一段"x"的时间.
所以我有一个Boolean "hit" = false,当他被击中时,它会改变true.这意味着他再次被击中,直到它再次变为假.
所以我试图在我的程序中设置一个函数来设置"x"秒的"计时器" IF hit = true,一旦该计时器达到"x"秒的数量,命中将被切换回假.
有人有主意吗?
谢谢!!
我的构造函数中有以下代码:
constructor(){
for (let i = 0; i < 90; i++) {
setTimeout(() => {
this.counter = this.counter - 1;
}, 1000)
}
}
Run Code Online (Sandbox Code Playgroud)
我真正想要的是显示一个倒计时 90 秒的数字。现在它立即从 90 倒计时到 0
我一直在使用Keith Wood的jQuery Countdown插件,它在Chrome 23版本之前一直工作得非常好.但是,我最近将浏览器升级到版本24.0.1312.52,现在计时器已停止更新.相反,时间仅在页面刷新时刷新.
IE 8/9,FF(最新版本)上的相同插件工作正常.
还有其他人面临这个问题吗?
我访问了插件的主页,但是计时器工作正常.
嗨,任何人都可以帮助我完成我的小项目,我一直在关注这个教程,我得到了我在EditText中插入1分钟的部分,进度条工作正常1每秒进度但是当我输入超过1分钟时EditText进度条不起作用.它没有下降请帮忙吗?
main.xml中
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#086A87">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:padding="10dp" >
<EditText
android:id="@+id/edtTimerValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="minutes"
android:inputType="phone" />
<Button
android:id="@+id/btnStartTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="2"
android:gravity="center"
android:text="Start Timer"
android:background="@drawable/custombuttongreen"
android:textColor="#fff"/>
<Button
android:id="@+id/btnStopTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="2"
android:gravity="center"
android:text="Stop Timer"
android:visibility="gone"
android:background="@drawable/custombuttongreen"
android:textColor="#fff"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical" >
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ProgressBar
android:id="@+id/progressbar"
android:layout_width="350dip"
android:layout_height="350dip"
android:indeterminate="false"
android:progressDrawable="@drawable/circle"
android:background="@drawable/circle_shape"
style="?android:attr/progressBarStyleHorizontal"
android:max="60"
android:progress="0" />
<TextView
android:id="@+id/tvTimeCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="00:00"
android:textColor="#fff" …Run Code Online (Sandbox Code Playgroud) countdown ×10
android ×5
timer ×4
intervals ×1
ios ×1
iphone ×1
jquery ×1
label ×1
nsdate ×1
nstimer ×1
overriding ×1
picker ×1
processing ×1
progress ×1
settimeout ×1
typescript ×1