私はここのUITableViewController を持っては.hファイルのコードiphoneでビューを再読み込みまたはリフレッシュするにはどうすればいいですか?
@interface addToFavourites : UITableViewController {
}
@end
であり、ここで.mファイルコードに
#import "addToFavourites.h"
@implementation addToFavourites
- (id)initWithStyle:(UITableViewStyle)style {
if (self = [super initWithStyle:style]) {
}
return self;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
}
// Configure the cell
return cell;
}
@end
で、別のクラスでは、私はこのコード
を使用して、このビューを示していますaddToFavouritesobj = [[addToFavourites alloc] initWithStyle:UITableViewStylePlain];
[self.navigationController pushViewController:addToFavouritesobj animated:YES];
このuitableviewcontroller
クラスのリロードメソッドをどのように呼び出すのですか?
このビューが自動的に私はテーブルをリロードするかどうかは非常に混乱していますテーブル
をgenratingので、テーブルビューを宣言する必要はありませんか?
あなたのコードについて軽度のご意見:Objective-Cでは、クラス名は大文字で始まります。あなたのaddToFavoritesクラスはAddToFavorites、AddToFavoritesControllerなどでなければなりません。私はAddFavoriteControllerを使用します。 Objective-Cの命名規則を使用すると、他の人があなたを助けやすくなります。たとえば、私は[addToFavorites alloc]を見て、allocがクラスメソッドであり、インスタンス上で呼び出すべきではないことを伝えようとしていました。 –