Tag: select器

如何通过自定义button单击时通过@select器传递数据?

我正在通过代码做一个button。 我有以下代码行来触发button被单击时的方法: [imagesButton addTarget:self action:@selector(photoClicked:) forControlEvents:UIControlEventTouchDown ]; 问题是我不能通过@selector将数据传递给方法; 如果button有一个背景图像名称“background.png”我怎么会发送背景图像的名称的方法,当button被点击? 这一切都必须通过代码。 谢谢! -Shredder

在运行循环的开始/结束处执行select器

iOS中的所有事件和方法都使用NSRunLoop处理:用户事件,方法调用,旋转,定时器,连接等。 我的问题是 : 如何在运行循环的精确时刻执行select器作为开始和结束?

将parameter passing给select器动作

我正处于一种我认为自己接近解决的情况,但也许不是。 我有一个自定义tableview单元格的tableview。 目前每个tableviewcell有3个uibuttons,访问它们并赋予它们function是没有问题的。 我遇到问题的3个button之一。 该button将用户从当前的导航控制器推到一个webview控制器,但我希望webview控制器是当前tableview单元格持有的http地址。 下面是我正在使用的代码的一小部分。 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifier = @"Identifier"; SearchTableCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"SearchTableCell" owner:nil options:nil]; //cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:reuseIdentifier]; for(id currentObject in topLevelObjects) { if([currentObject isKindOfClass:[SearchTableCell class]]) { cell = (SearchTableCell *)currentObject; […]

在Swift语言_cmd

我以前的问题被标记为重复。 我试图编辑我的问题,但我不能删除重复的标签,所以我必须创build一个新的什么是快速等效于_cmd? 我想要得到当前的方法名称,以类似于这个格式的消息 [NSExeception raise:NSInternalInconsistencyException format:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)] 另外,我想用_cmd作为关键字来设置关联的对象。 有谁知道在Swift中的_cmd相当于我真的很感激。

iOS Safari Mobile禁用上一个和下一个selectinput

上周五我发现了类似的问题,但似乎再也找不到了。 如果有人能够朝正确的方向捅我,这将是伟大的。 基本上,我有一个页面上的多个select菜单。 第一个填充负载,第二个填充确定第一个的select。 很简单。 但是,在iOS设备上,当您点击select元素时,会启动iOS滚动条以供您select。 如果有人使用本机iOS previous或nextbutton,则以下<select>input将不会收集以前的select数据。 您必须done点击done然后启动下一个select菜单为填充的结果是准确的。 有一个名为http://m.lemonfree.com的网站,强制你点击done而不是prev/next ,也可以阻止你从iOSselect菜单closuresselect提示。 基本上迫使用户selectdone 。 我会非常有兴趣了解他们如何实现这一function。 干杯! 这是我的代码,以防万一: <form method="post" action="list.php" class="striped-bg-inverted"> <p> <label for="make">Make</label> <select name="make" id="make" required="required"> <option selected>Select a Make</option> <?php foreach ($usedMakes->MakeResult as $MakeResult) { ?> <option value="<?php echo $MakeResult->makeId; ?>"><?php echo $MakeResult->makeName; ?></option> <?php } ?> </select> </p> <p> <label for="model">Model</label> <select […]

Objective-C传递方法作为参数

你如何将一个方法作为parameter passing给另一个方法? 我正在跨class级做这个。 A类: + (void)theBigFunction:(?)func{ // run the func here } B类: – (void)littleBFunction { NSLog(@"classB little function"); } // somewhere else in the class [ClassA theBigFunction:littleBFunction] C类: – (void)littleCFunction { NSLog(@"classC little function"); } // somewhere else in the class [ClassA theBigFunction:littleCFunction]

popup/模式select器的IOS7中的文本字段

我很难搞清楚如何实现一个标准的popup式选取器。 与用户select生日文本字段ID(如popup式选取器)出现时的许多应用程序注册屏幕一样,用户可以select其生日,单击“完成”,格式化的date将添加到文本字段中。 这似乎不应该是所有的困难,但似乎没有简单,清晰,标准的方式做到这一点在ios7。 我搜查了互联网,看到有人说使用模态,其他人说动作表,其他人说popup窗口,还有人说,一个单独的视图controller.Can任何人都可以告诉我这样做的标准方式和/或提供一个啧啧的链接或如何实施它的一个片段?

isEqualToString的无法识别的select器错误:设置标签的文本时

我试图从我的模型对象( searchRecipeDetailsVariable )的属性之一设置标签的文本,但我得到一个错误 //Extract number of servings from dictionary and place in model self.searchedRecipeDetailsVariable.numberOfServings = [self.detailedSearchYummlyRecipeResults objectForKey: @"numberOfServings"]; //log number of servings to check that it works NSLog(@"Number of Servings, %@",self.searchedRecipeDetailsVariable.numberOfServings); self.numberOfServingsLabel.text = self.searchedRecipeDetailsVariable.numberOfServings; 当我打印的价值,我可以看到正确的号码。 但是,当我尝试设置numberOfServingsLabel.text收到错误: – [__ NSCFNumber isEqualToString:]:发送到实例0x9028390的无法识别的select器 你可以想象,我不太清楚为什么。 我试图直接用string设置文本,如下图,这个工程。 self.numberOfServingsLabel.text = @"500"; 然后来testing我其实有一个string,我尝试了下面。 这工作正常。 NSString *test = self.searchedRecipeDetailsVariable.numberOfServings; NSLog(@"test numberof servings string, […]

尝试以编程方式selectUIWebView中的文本时setStart和setEnd引发错误

这里是我在我的UIWebView中使用的一些HTML: <div id = "1"> <span style = "background-color:red"> <a href = "10&20"> This is a link </a> </span> </div> 一旦链接被点击,我想以编程方式selectUIWebView中的链接文本(所以“这是一个链接”,现在将用蓝色的iOS文本select工具突出显示)。 这就是为什么我要在标签的href中发送一些范围信息。 这是我正在用来尝试做这个程序select的呼叫: //set content editable true [self.webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"selectElementContentsInRange(document.getElementById('1'), 10, 20)"]]; 这是JavaScript的function: function selectElementContentsInRange(el, first, second) { var range = document.createRange(); alert("Makes it here"); range.setStart(el.firstChild, first); alert("Doesn't make it here"); range.setEnd(el.firstChild, second); var sel […]

通过UIButton的select器传递参数

我在detailDisclousure的标注上有一个detailDisclousurebutton。 当按下这个button时,我需要调用一个方法来传递一个参数来标识调用它的annotation 。 怎么可能呢? 这是我的观点ForAnnotation: – (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { if ([annotation isKindOfClass:[Annotation class]]) { static NSString* identifier = @"identifier"; MKPinAnnotationView* pinView = (MKPinAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:identifier]; if (pinView == nil) { pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier]autorelease]; } Annotation *antt = annotation; pinView.canShowCallout = YES; pinView.draggable = YES; UIButton* detailButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; [detailButton […]