标签: uistepper

如何使用UIStepper

我正在努力UIStepper增加或减少一个整数,但" - "和"+"都会增加整数!如何识别"+"和" - "按钮?

UIStepper头文件中有两个UIButtons:

UIButton *_plusButton;
UIButton *_minusButton;
Run Code Online (Sandbox Code Playgroud)

例如 :

- (IBAction)changeValue:(id)sender 
{        
    UIStepper *stepper = (UIStepper *) sender;

    stepper.maximumValue = 10;
    stepper.minimumValue = 0;      
    if (stepper)
    {
        integer++;
        [label setText:[NSString stringWithFormat:@"%d",integer]];
     }
     else
     { 
         integer--;
         [label setText:[NSString stringWithFormat:@"%d",integer]];
     }

}
Run Code Online (Sandbox Code Playgroud)

objective-c ios uistepper

39
推荐指数
1
解决办法
7万
查看次数

表格视图单元格上的步进器(快速)

我将步进器的出口和操作放入表格视图单元格中,并使用协议委托将其连接到表格视图。当我点击第一行中的步进器时,步进器值在第一行中正常显示,但它也出现在某个随机行中。如何解决这个问题?

表格视图单元格

protocol ReviewCellDelegate{
    func stepperButton(sender: ReviewTableViewCell)
}

class ReviewTableViewCell: UITableViewCell {
   @IBOutlet weak var countStepper: UIStepper!
   @IBOutlet weak var stepperLabel: UILabel!

override func awakeFromNib() {
    super.awakeFromNib()
    // Initialization code
}

override func setSelected(selected: Bool, animated: Bool) {
    super.setSelected(selected, animated: animated)

    // Configure the view for the selected state
}

@IBAction func stepperButtonTapped(sender: UIStepper) {
    if delegate != nil {
        delegate?.stepperButton(self)
        stepperLabel.text = "x \(Int(countStepper.value))"

    }
}
Run Code Online (Sandbox Code Playgroud)

视图控制器

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cellIdentifier = …
Run Code Online (Sandbox Code Playgroud)

uitableview ios uistepper swift

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

UIStepper.找出是递增还是递减

确定在UIStepper中是否按下加号或减号按钮我使用此方法:

- (void)stepperOneChanged:(UIStepper*)stepperOne
Run Code Online (Sandbox Code Playgroud)

我将stepperOne.value与我的TableView类中保存的全局值进行比较.
我不认为这是正确的方法.

所以为了澄清我会显示我正在使用的"坏"代码:

- (void)stepperOneChanged:(UIStepper*)stepperOne
{
      BOOL PlusButtonPressed=NO;  
      if(stepperOne.value>globalValue)  
      {   
          PlusButtonPressed =YES;  
      }  
      globalValue=stepperOne.value;

    ////do what you need to do with the PlusButtonPressed boolean
}
Run Code Online (Sandbox Code Playgroud)

那么这样做的正确方法是什么?(无需保存全局变量)

ios uistepper

5
推荐指数
4
解决办法
9753
查看次数

Materialisecss框架是否有步进器?

是否有任何方法或任何插件使用Materialisecss框架制作步进器并遵循Material Design准则?

formwizard materialize uistepper material-design

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

更改UIStepper的大小

我似乎无法改变大小UIStepper:

  1. 在IB中,"宽度"和"高度"框显示为灰色.
  2. 我用过initWithFrame:

    UIStepper*stepper = [[UIStepper alloc] initWithFrame:CGRectMake(300,638,120,80)];

    但它不会改变大小.关于SO的几个帖子似乎暗示它是可变的.有什么建议吗?

cocoa-touch objective-c ios uistepper

3
推荐指数
3
解决办法
6945
查看次数

无法在Xcode 5 Storyboard中创建IBAction连接

一个看似非常基本的问题,但令我感到沮丧的是,我无止境地拖延进步.当我点击和拖拽UIButtonUIStepper到视图控制器,还可以选择增加IBAction的连接没有被列出.

视图控制器被调用BuyNowVC,在我看来BuyNowVC.h:

@interface BuyNowVC : UIViewController {
    IBOutlet UIButton *buyButton;
    IBOutlet UIStepper *myStepper;
}

@property (nonatomic, retain) IBOutlet UIButton *buyButton;
@property (nonatomic, retain) IBOutlet UIStepper *myStepper;

- (IBAction)buttonPressed;
- (IBAction)stepperPressed;
Run Code Online (Sandbox Code Playgroud)

并在BuyNowVC.m:

@synthesize buyButton;
@synthesize myStepper;

- (IBAction)buttonPressed {
    NSLog(@"Button pressed!");
}

- (IBAction)stepperPressed {
    NSLog(@"Stepper pressed!");
}
Run Code Online (Sandbox Code Playgroud)

我肯定CTRL拖到视图控制器本身,而是唯一的选择,我得到两个UIButtonUIStepper的行动Segue公司:推,模式,自定义.没有迹象buttonPressedstepperPressed.

编辑

我还应该提一下,这不是根VC,并且UIButton目前与下一个View Controller的Segue绑定(所以我可以浏览我的模型)但是如果我删除它似乎没有什么区别.

xcode objective-c uibutton ios uistepper

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

Swift - 在TableView单元格中使用步进器增加标签

另一个Swift初学者来了.我只想在每个TableView单元格中使用一个Stepper来增加同一单元格中的标签.

我在这个主题上找到了几个问题,但是它们包含了其他元素,而我却无法提取基本概念.

Swift Stepper Action在同一个单元格内更改UITextField和UILabel

tableview单元格上的步进(swift)

到目前为止,我已经为我的Label和Stepper连接了IBOutlets,并为我的单元类中的Stepper连接了IBAction.

class BuyStatsCell: UITableViewCell{

    //these are working fine

    @IBOutlet weak var category: UILabel!
    @IBOutlet weak var average: UILabel!
    @IBOutlet weak var price: UILabel!


    //Outlet for Label and Stepper - How do I make these work?

    @IBOutlet weak var purchaseAmount: UILabel!
    @IBOutlet weak var addSubtract: UIStepper!

    //Action for Stepper - And this?

    @IBAction func stepperAction(_ sender: UIStepper) {
        self.purchaseAmount.text = Int(sender.value).description

    }

}
Run Code Online (Sandbox Code Playgroud)

我理解在cellForRowAt indexPath中重用单元的概念

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { …
Run Code Online (Sandbox Code Playgroud)

tableview uistepper swift

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

Angular 7 - 与路由一起使用的步进器组件

我需要 Angular 7 的 Stepper 组件的经过检查的解决方案,该解决方案可与 Angular 路由一起使用。

不是Material Design Stepper - 它确实适用于简单的表单,但不适用于路由。

我尝试做的事情<mat-horizontal-stepper>是这样的:

组件.html:

<mat-horizontal-stepper (selectionChange)="selectionChanged($event)" [linear]="true">
    <mat-step *ngFor="let step of steps; let i = index" [label]="step.title">
        <router-outlet *ngIf="i === selectedStepIndex"></router-outlet>
    </mat-step>
</mat-horizontal-stepper>
Run Code Online (Sandbox Code Playgroud)

组件.ts:

public selectedStepIndex: number = 0;

selectionChanged(event: any) {
    this.selectedStepIndex= event.selectedIndex;
    const url = '/some-path/' + this.links[this.selectedStepIndex].path;
    this.router.navigate([url]);//using -> private router: Router
}
Run Code Online (Sandbox Code Playgroud)

但是,由于某种原因我无法返回。Stepper 尝试向后导航,但它显示相同的页面,除非它是 Stepper ( i = 0) 的第一页。

我将非常感谢任何建议(也许还有工作示例),或者有关如何使用<mat-horizontal-stepper>.

uistepper angular-routing angular angular7

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

uitabletecell中的UIStepper

在我的应用我有自定义UITableViewCell,我有UIStepperUILabel自定义单元格.我不知道如何检查单击哪个步进器.那么它是一种了解单击哪个单元步进器的方法吗?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell;
    NSString *CellIdentifier = @"Cell";
    cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
        if ([nib count] > 0) {
            cell = self.tbcell;
        }
    }
    return cell;
}
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uitableview ios uistepper

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

修改UIStepper自动重复行为

我有一个客户希望我修改UIStepper的自动重复行为.

如果用户选择触摸并保持说步进器的+按钮,则步进器的值开始以每半秒左右的速率增加1秒,然后在约3秒后,值开始变化得更快.

无论如何都要修改它的工作原理,例如,如果用户点击并保持,值会立即以更快的速率增加?

我查看了UIStepped文档,但我没有看到任何相关内容,但我想知道是否有办法通过IBAction或其他方式来做到这一点.

uicontrol ios ios5 uicontrolevents uistepper

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