小编NCo*_*der的帖子

无效时NSTimer不会停止

我的.h文件中有以下代码:

#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#import <AVFoundation/AVFoundation.h>
#import <MapKit/MapKit.h>

@interface LandingController : UIViewController<CLLocationManagerDelegate> {
    CLLocationManager *LocationManager;
    AVAudioPlayer *audioPlayer;

}

@property (nonatomic, retain) NSTimer *messageTimer;

- (IBAction)LoginButton:(id)sender;

@end
Run Code Online (Sandbox Code Playgroud)

我的.m文件中有以下代码:

@interface LandingController ()

@end

@implementation LandingController
@synthesize messageTimer;

- (void)checkForMessages
{

    UIAlertView *alert = [[UIAlertView alloc]
                          initWithTitle:@"BINGO:"
                          message:@"Bingo This Works"
                          delegate:nil
                          cancelButtonTitle:@"Okay"
                          otherButtonTitles:nil];

    [alert show];

}

- (IBAction)LoginButton:(id)sender {

    if ([UserType isEqualToString:@"Owner"]) {

        if (messageTimer){ 
        [self.messageTimer invalidate];
        self.messageTimer = nil;
        }

    } else {

        if (!messageTimer){

           self.messageTimer = [NSTimer scheduledTimerWithTimeInterval:10.0
                                                             target:self
                                    selector:@selector(checkForMessages) …
Run Code Online (Sandbox Code Playgroud)

objective-c nstimer

8
推荐指数
2
解决办法
1万
查看次数

如何使用此javascript函数将变量发送到表单?

我有这个onclick电话:

onClick="mySubmit();
Run Code Online (Sandbox Code Playgroud)

调用此函数:

function mySubmit(){
    document.getElementById("myForm").submit();
}
Run Code Online (Sandbox Code Playgroud)

然后提交此表单:

<form id="myForm" action="action.php" method="post">
Run Code Online (Sandbox Code Playgroud)

我的问题是:如何从onClick向表单发送变量以获得类似的东西<form id="myForm" action="action.php?id=**(the variable sent from the onclick goes here)**" method="post">

谢谢!

javascript forms variables onclick submit

6
推荐指数
2
解决办法
4万
查看次数

如何使用<li>而不是提交按钮提交表单?

我希望能够提交表单,但我不想点击提交按钮,我希望能够点击一个<li>元素并让它提交.

任何帮助都会很棒!

提前致谢!

Ncoder

forms submit html-lists

5
推荐指数
1
解决办法
2万
查看次数

指定jQuery自动完成结果宽度

如何为以下jQuery自动完成指定结果的宽度?

$( "#autocomplete" ).autocomplete({
    minLength: 2,   
    source: function( request, response ) {
        var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( request.term ), "i" );
        response( $.grep( tags, function( item ){
            return matcher.test( item );
        })
    }
});
Run Code Online (Sandbox Code Playgroud)

谢谢!

jquery autocomplete

2
推荐指数
1
解决办法
3676
查看次数

流媒体实时网络摄像头

建立一个网站,成员可以将其网络摄像头流式传输到我的服务器,以便其他成员可以查看当前正在流式传输的实时源.

有点像:http://chatroulette.com

如何获取会员的网络摄像头,将订阅源推送到服务器,然后允许其他人实时查看订阅源?

该网站是基于网络的,用PHP编写,带有MySQL数据库 - 但我愿意添加Javascript,jQuery,Flash或其他任何工作.

我知道这很广泛但真的需要一些指导!

streaming webcam video-streaming viewing live-streaming

1
推荐指数
1
解决办法
6638
查看次数

从另一个视图更新文本标签

我有一个NSTimer每10秒运行一次,并从LandingController.m开始.当您转到应用程序中的其他视图时,它将继续运行.我希望能够(当在该计时器内满足某个条件时)从另一个视图更新标签字段GuardMenu.m我想要更新的标签名为CurrentZone.text,我想将它从值"N"更新为值"Y".

这是我在LandingController.m上的计时器

self.messageTimer = [NSTimer scheduledTimerWithTimeInterval:10.0
                        target:self
                        selector:@selector(checkForMessages)                                                                     
                        userInfo:nil
                        repeats:YES];
Run Code Online (Sandbox Code Playgroud)

在LandingController.m上调用它

- (void)checkForMessages
{

        if ( //some condition here ){

        //update CurrentZone.text label in GuardMenu view and set equal to "Y"

        } else {

        //no need to update label in GuardMenu as it's currently equal to "N"

        }


    }
Run Code Online (Sandbox Code Playgroud)

objective-c nstimer ios

-1
推荐指数
1
解决办法
1309
查看次数