我怎么能够从控制人员那里获得一系列的UIT延伸区?
EDIT:我不想将案文领域硬化成一个阵列。 我实际上想从该代表的召集人那里获得所有领域的代表名单。
我怎么能够从控制人员那里获得一系列的UIT延伸区?
EDIT:我不想将案文领域硬化成一个阵列。 我实际上想从该代表的召集人那里获得所有领域的代表名单。
Recursive implementation to search all subviews subviews: (this way you catch textfields embedded in uiscrollview, etc)
-(NSArray*)findAllTextFieldsInView:(UIView*)view{
NSMutableArray* textfieldarray = [[[NSMutableArray alloc] init] autorelease];
for(id x in [view subviews]){
if([x isKindOfClass:[UITextField class]])
[textfieldarray addObject:x];
if([x respondsToSelector:@selector(subviews)]){
// if it has subviews, loop through those, too
[textfieldarray addObjectsFromArray:[self findAllTextFieldsInView:x]];
}
}
return textfieldarray;
}
-(void)myMethod{
NSArray* allTextFields = [self findAllTextFieldsInView:[self view]];
// ...
}
如果你知道需要<条码>。 NSArray 包含所有UIText Field
的代码,然后是为什么不添加到一个阵列中?
NSMutableArray *textFields = [[NSMutableArray alloc] init];
UITextField *textField = [[UITextField alloc] initWithFrame:myFrame];
[textFields addObject:textField]; // <- repeat for each UITextField
如果你使用刀子,则使用<代码>。 缩略语
@property (nonatomic, retain) IBOutletCollection(UITextField) NSArray *textFields;
然后将所有<代码>UIText Field连接到该阵列。
- 采用以下代码,以获取包含所有以观点表述的统法特领域的文本价值:
NSMutableArray *addressArray=[[NSMutableArray alloc] init];
for(id aSubView in [self.view subviews])
{
if([aSubView isKindOfClass:[UITextField class]])
{
UITextField *textField=(UITextField*)aSubView;
[addressArray addObject:textField.text];
}
}
NSLog(@"%@", addressArray);
extension UIView
{
class func getAllSubviewsOfType<T: UIView>(view: UIView) -> [T]
{
return view.subviews.flatMap { subView -> [T] in
var result = UIView.getAllSubviewsOfType(view: subView) as [T]
if let view = subView as? T {
result.append(view)
}
return result
}
}
func getAllSubviewsWithType<T: UIView>() -> [T] {
return UIView.getAllSubviewsOfType(view: self.view) as [T]
}
}
如何使用文本领域:
let textFields = self.view.getAllSubviewsWithType() as [UITextField]
你们可以通过控制者的观点表。
参看<><><>>>>>>>>。
NSMutableArray *arrOfTextFields = [NSMutableArray array];
for (id subView in self.view.subviews)
{
if ([subView isKindOfClass:[UITextField class]])
[arrOfTextFields addObject:subView];
}
http://www.ohchr.org。 无全球变量的回收(时间期限)
-(NSArray*)performUIElementSearchForClass:(Class)targetClass onView:(UIView*)root{
NSMutableArray *searchCollection = [[[NSMutableArray alloc] init] autorelease];
for(UIView *subview in root.subviews){
if ([subView isKindOfClass:targetClass])
[searchCollection addObject:subview];
if(subview.subviews.count > 0)
[searchCollection addObjectsFromArray:[self performUIElementSearchForClass:targetClass onView:subview]];
}
return searchCollection;
}
I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...
HI, In our application i am using corelocationframework when opening application a alert for allow and dont allow.when clicking on the allow for current location we will show current location.When ...
Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...
我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......
我希望我与四舍五入的累进角进行网上讨论。
我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。
We have a restaurant table that has lat-long data for each row. We need to write a query that performs a search to find all restaurants within the provided radius e.g. 1 mile, 5 miles etc. We have ...
I like to write bash shell scripts on my iPhone, put them in an app folder with an icon, plist, etc., so they execute like apps by tapping their icon on SpringBoard. This is not interactive like ...