這裏是我的代碼:在App和UITableView的
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (isPurchased == NO) {
return [UITableviewExample count];
[UITableviewExample release];
}
else
{
return [UITableviewExample2 count];
[UITableviewExample2 release];
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
if (isPurchased == NO) {
cell.textLabel.text = [UITableviewExample objectAtIndex:indexPath.row];
[UITableviewExample release];
}
else {
cell.textLabel.text = [UITableviewExample2 objectAtIndex:indexPath.row];
[UITableviewExample2 release];
}
}
return cell;
}
誰能幫幫我好嗎?成功購買應用程序後,無需更改。如果我用
-(IBAction)test
{
if (isPurchased == yes) {
buyButton.hidden = yes;
}
}
很好用。我嘗試了兩種應用程序,應用程序內購買,一切都很好,即使我用於隱藏,更改標籤文本,它的工作原理,我如何使用UITableView在應用程序內購買?我想在成功購買應用程序後更改行。我的錯誤在哪裏?謝謝。
不要粗魯,但你的代碼很難理解你在做什麼。這些「UITableViewExample」對象是什麼,你爲什麼將它們釋放到任何地方?你真的應該閱讀並理解Apple的Objective-C風格指南和內存管理指南。它將幫助您編寫更多標準化的代碼,並幫助他人更快地理解它。此外,您的文字說明還不清楚,您也沒有提供關於應用內購買本身發生情況的信息。由於這些原因,我必須降低你的問題。 –
另外,請閱讀Xcode的標籤wiki。這個問題與Xcode沒有任何關係。 – 2012-09-01 06:43:38