我设法重新调配了可转让的电文Cell的变数,并把它与TWTweetComposeViewController混为一谈,但我却遇到了一个问题。 它总是歪曲可调意见中最后一行的变量。
我在此阐述: 我有1艘tw子和4个UI子,位于可加利用的电文中。 4个职业介绍所正在从一个名单上删除信息,以填表。 每个囚室都有一个tw子,以敲响囚室的信息,但那是我处理问题的。 <>总是把表上最后一行提供的信息,而不是表中的斜线。 非常感谢任何帮助。
UITableViewCell.h
@property (nonatomic, strong) IBOutlet UILabel *playerOneLabel;
@property (nonatomic, strong) IBOutlet UILabel *playerOneScoreLabel;
@property (nonatomic, strong) IBOutlet UILabel *playerTwoLabel;
@property (nonatomic, strong) IBOutlet UILabel *playerTwoScoreLabel;
主要观点
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"ScoreListCell";
ScoreCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Configure the cell...
NSDictionary * dictionary = [scoresArray objectAtIndex:indexPath.row];
cell.playerOneLabel.text = [dictionary objectForKey:@"playerOneName"];
cell.playerOneScoreLabel.text = [dictionary objectForKey:@"playerOneScore"];
cell.playerTwoLabel.text = [dictionary objectForKey:@"playerTwoName"];
cell.playerTwoScoreLabel.text = [dictionary objectForKey:@"playerTwoScore"];
self.player1Name = cell.playerOneLabel;
self.player1Score = cell.playerOneScoreLabel;
self.player2Name = cell.playerTwoLabel;
self.player2Score = cell.playerTwoScoreLabel;
return cell;
}
并且最后,主要观察控制器的tw:
- (IBAction)twitter:(id)sender {
if ([TWTweetComposeViewController canSendTweet])
{
TWTweetComposeViewController *tweetSheet =
[[TWTweetComposeViewController alloc] init];
NSString *text = [NSString stringWithFormat:@"%@-%@, %@-%@",
player1Name.text, player1Score.text, player2Name.text, player2Score.text];
[tweetSheet setInitialText:text];
[self presentModalViewController:tweetSheet animated:YES];
}
else
{
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Sorry"
message:@"Tweet unsuccessful. Make sure your device has an internet connection and you have a Twitter account."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
}