【问题标题】:How to get this text value out of the NSArray?如何从 NSArray 中获取此文本值?
【发布时间】:2017-11-24 02:13:12
【问题描述】:

我有一个数组,当我按如下方式输出 NSlog 时

 NSLog(@"%s entered with variants: %@ and SelectedVariants = %@", __PRETTY_FUNCTION__, [_valueLabels objectAtIndex:0], _selectedVariantValue);

给我以下输出

2017-11-24 10:09:54.971304+0800 NWMPos[547:109817] -[ShopifyProductCardView addButtonTapped:] entered with variants: <UILabel: 0x1040e5330; frame = (0 0; 33.6667 17); text = 'small'; alpha = 0.87; gestureRecognizers = <NSArray: 0x1c4645c10>; layer = <_UILabelLayer: 0x1c0298d30>> and SelectedVariants = (null)

我需要获取文本 ="small" 并将其缩小为 NSString,必须有一些方法可以做到这一点,我该如何找到它?

【问题讨论】:

    标签: ios objective-c uilabel nsarray


    【解决方案1】:

    它是 NSArray 中的 UILabel,所以我只是将 Array 上下文分配给 UILabel 并正确读取其文本,如下所示,一切正常

    UILabel *jongel = [_valueLabels objectAtIndex:0];
    UILabel *jongel2 = [_valueLabels objectAtIndex:1];
    NSString *pelleplutt = jongel.text;
    NSString *pelleplutt2 = jongel2.text;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-05
      相关资源
      最近更新 更多