-2

クレジット カードをスキャンし、その情報を取得してテーブル ビューで使用する card io API を使用しています。次のフィールドに入力する必要があります。

-クレジット カード番号 -cvv -有効期限 (別の変数として使用されるため、文字列を追加しました)

ここに私のコードがあります:

.m ファイル

- (void)userDidProvideCreditCardInfo:(CardIOCreditCardInfo *)info inPaymentViewController:(CardIOPaymentViewController *)scanViewController {

        BillingTableViewCell *aCell;

        NSString *myString = info.expiryMonth;
        NSString *otherString = [myString stringByAppendingString: info.expiryYear];

        aCell = (BillingTableViewCell *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
        aCell.text.text = info.cardType;


        aCell = (BillingTableViewCell *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0]];
        aCell.textLabel.text = info.cardNumber;


        aCell = (BillingTableViewCell *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:2 inSection:0]];
        aCell.text.text = info.cvv;


        aCell = (BillingTableViewCell *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:3 inSection:0]];
        aCell.text.text = info.zip;


        aCell = (BillingTableViewCell *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:5 inSection:0]];
        aCell.text.text = otherString;


    [scanViewController dismissModalViewControllerAnimated:YES];

ここに私の.hファイルがあります:

property(nonatomic, assign, readwrite) NSUInteger expiryMonth;  
@property(nonatomic, assign, readwrite) NSUInteger expiryYear;  
@property(nonatomic, copy, readwrite) NSString *cvv;
@property(nonatomic, copy, readwrite) NSString *zip;

スレッド エラーが何度も発生し、情報がテキスト フィールドに入力されません。私は何を間違っていますか?

エラー:

0x38fa65c6:  push.w {r3, r4}
0x38fa65ca:  ldr    r4, [r0] thread 1: EXC_BAD_ACCESS (code=1, address=0x5)
0x38fa65cc:  lsr.w  r9, r1, #2
4

1 に答える 1

2

UITableView にデータを入力しようとしている場合は、次の 2 つのメソッドを実装する必要があります。

- (UITableViewCell *)tableview:(UITableView *)tableView 
         cellForRowAtIndexPath:(NSIndexPath *) indexPath

- (NSInteger)tableView:(UITableView *)tableView 
 numberOfRowsInSection:(NSInteger)section

次に、最初のメソッド ( tableView: cellForIndexPath:) で を作成し、UITableViewCellそのプロパティにデータを入力します。

ViewController を UITableView のデリゲートおよびデータソースに設定してください。

于 2013-07-19T08:35:49.110 に答える