سؤال

أحاول إنشاء ayableview للسماح للمستخدم بإدخال البيانات، على غرار الكثير من الإعدادات ultipeviews، مع بعض textflields و Callouts إلى تطبيقات المائدة الأخرى لصناديق الاختيار.لمثل هذه الميزة المشتركة في التطبيقات، لا يبدو أن هذا مستقيم للغاية إلى الأمام.

أواجه مشكلة في الوصول إلى فهرستها.هنا هو المكان الذي أخصصه مخصص القديم. giveacodicetagpre.

في My TextField Class's Class الخاص بي، in - (ID) interwithstyle: أحاول الوصول إلى الفهرسة مع: giveacodicetagpre.

... من أجل ضبط علامة TextField مثل: giveacodicetagpre.

هل يمكن لأي شخص أن يلقي بعض الضوء على مشكلتي أو توجيهي في اتجاه إنشاء جدول الجدول الإعداد الأساسي برمجيا.

شكرا

هل كانت مفيدة؟

المحلول

I think the problem might be that at the time of initialisation of your cell it hasn't been added to the UITableView - hence self.superview is returning nil.

UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[TextFieldCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];      
}
[cell setTag:indexPath.row];

You will need to add a setTag: method to your TextFieldCellClass. I presume that code was inside cellForIndexPath or whatever, so indexPath will be passed to that method.

The set tag method should look something like this:

-(void)setTag:(int)tag {
    textRow.tag = tag;
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top