Мы можем использовать Map
для извлечения ([
) предложений из list
('columnSentence') на основе соответствующих list
индексов в 'myIndexes'
Map(`[`, columnSentence, myIndexes)
map2
из purrr
library(purrr)
map2(columnSentence, myIndexes, `[`)
Быстрый и грязный код:
- (void)viewDidLoad {
[super viewDidLoad];
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100, 100, 100, 40)];
textField.borderStyle = UITextBorderStyleLine;
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
label.text = @"mg";
label.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.0];
textField.rightViewMode = UITextFieldViewModeAlways;
textField.rightView = label;
[self.view addSubview:textField];
[label release];
[textField release];
}
Обратите внимание, что я добавляю подпредставление из ViewController, вы можете сделать это с точки зрения.