我在iOS开发以及开发领域都比较新手。
我正在开发一个时间/记录应用,但遇到了一个奇怪的问题。在我的一个视图控制器上,我有一个UITableView,其中每个单元格都是一个按钮,可以导航到不同的视图控制器。在第一个单元格中,用户应该能够按下UIButton来运行一个方法以开始计时。运行该方法后,它会激活一个第二个UIButton,用户可以按下停止计时。同时,右侧的UILabel显示经过的时间。
到目前为止,这一切都很正常,直到几天前。我下载并开始使用Xcode 5.1 beta 5,并在其中开始开发应用程序。现在,在我的iPhone 5S或任何使用iPhone 5S的测试人员上,UIButtons都不会出现。它可以在iPhone模拟器上和真正的非5S iPhone(包括iPad)上工作。
我想也许是一个64位问题,我查看了我的代码并没有找到任何不能在64位设备上工作的问题。但我看了Apple Developer Video,它说64位设备上的32位应用程序将简单地加载32位的iOS库并像那样运行。因为迄今为止在任何设备上都没有遇到任何问题,所以我还没有在我的应用程序上启用ARM-64。iOS 7.1 SDK在beta 5中是否有一些更改,需要在64位设备上以不同的方式调用tableviews或UIButtons?我甚至在一个64位模拟器上尝试了它,也可以正常工作。
下面是相关代码。作为开发新手,我会感激任何帮助。
//Set Button Properties
self.startTimeButton.frame = CGRectMake(0, 0, 100, 39);
self.startTimeButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[self.startTimeButton setTitle:@"Start Time" forState:UIControlStateNormal];
self.startTimeButton.backgroundColor = [UIColor greenColor];
[self.startTimeButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[self.startTimeButton setTitleColor:[UIColor blackColor] forState:UIControlStateDisabled];
[self.startTimeButton addTarget:self action:@selector(startCountingTime) forControlEvents:UIControlEventTouchUpInside];
//Set Button 2 Properties
self.stopTimerOut = [UIButton buttonWithType:UIButtonTypeRoundedRect];
self.stopTimerOut.frame = CGRectMake(100, 0, 100, 39);
[self.stopTimerOut setTitle:@"Stop Time" forState:UIControlStateNormal];
self.stopTimerOut.backgroundColor = [UIColor redColor];
[self.stopTimerOut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[self.stopTimerOut addTarget:self action:@selector(stopCountingTime) forControlEvents:UIControlEventTouchUpInside];
//Set Timer Label
self.timerDisplayLabel = [[UILabel alloc] initWithFrame:CGRectMake(250, 0, 60, 40)];
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
// First Section - Time Section
if (indexPath.section == 0) {
if (indexPath.row == 0) {
[cell addSubview:self.startTimeButton];
[cell addSubview:self.stopTimerOut];
[cell addSubview:self.timerDisplayLabel];
[cell addSubview:self.timerActivityDiscloser];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryType = UITableViewCellAccessoryNone;
}
if (indexPath.row == 1) {
cell.textLabel.text = @"Manually Enter Time";
}
if (indexPath.row == 2) {
cell.textLabel.text = @"View Time for Month";
}
}
这是我的头文件
@property (weak, nonatomic) UIButton *startTimeButton;
@property (weak, nonatomic) UIButton *stopTimerOut;
@property (strong, nonatomic) UILabel *timerDisplayLabel;
感谢您的帮助。