如何从NSArray中获取此文本值?

时间:2017-11-24 02:13:12

标签: ios objective-c uilabel nsarray

我有一个数组,当我按如下方式输出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)

我需要找到文字=&#34; small&#34;并获得一个很小的NSString,必须有一些方法来做到这一点我怎么找到它?

1 个答案:

答案 0 :(得分:0)

这是NSArray中的UILabel所以我只是简单地将数组上下文分配给UILabel并正确读取其文本,如下所示

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