1 つのテキストフィールドと静的配列があります。次のような配列にアイテムがあります。12345-支店名。しかし、テキストフィールドからソープコールに 12345 だけを送信したいです。どのようにできるのか?
.h
-(IBAction)Send:(UIButton *)sender;
@property (strong, nonatomic) NSArray *branches;
@property (unsafe_unretained,nonatomic) IBOutlet UITextField *BranchextField;
.m
-(IBAction)Send:(UIButton *)sender{
NSString *mensagemSOAP= [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
"<soap:Body>\n"
"<UrunToplamiGetir xmlns=\"http://tempuri.org/\">\n"
"<BranchCode>%@</BranchCode>\n"
"</UrunToplamiGetir>\n"
"</soap:Body>\n"
"</soap:Envelope>\n"_BranchextField.text];
}
私のアラスはここにいます
- (NSArray *)allbranches
{
if(!self.branches){
NSArray *branchNames = [self allCountries];
NSMutableArray *mutablebranch = [NSMutableArray new];
for(NSString *branchName in branchNames){
DEMOCustomAutoCompleteObject *branch = [[DEMOCustomAutoCompleteObject alloc]
initWithBranch:branchName];
[mutableBranches addObject:branch];
}
[self setBranchObjects:[NSArray arrayWithArray:mutableBranch]];
}
return self.branches;
}
- (NSArray *)allBranches
{
NSArray *branches =
@[
@"12345-NAME OF BRANCH",
@"67853-BRANCH 2",
@"43223-BRANHC 3",
@"66532-BRANCH 4",
@"76733-BRANCH 99",
];
return countries;
}