滚动浏览我的tableview时,活动的tableView单元格会一直处于禁用状态

时间:2017-01-23 17:09:15

标签: ios swift uitableview swift2 cell

我的应用程序有一个包含不同部分的UITableView。我想只允许访问前3个部分,即索引路径0,1和2.我的问题是我的代码在应用程序启动时有效。但是,当我向下滚动表视图部分并向上滚动时,我回到它们时,禁用了tableview部分0,1和2的顶部。我怎样才能解决这个问题?

 firebaseAuth.createUserWithEmailAndPassword(email, password)
                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {

                        //checking if success
                        if(task.isSuccessful()){
                            UserInformation userInformation = new UserInformation(username);


                            databaseReference.child("users").setValue(userInformation);
                            Toast.makeText(MainActivity.this,"Successfully registered",Toast.LENGTH_LONG).show();
                            finish();
                            startActivity(new Intent(getApplicationContext(), Users.class));
                        }

1 个答案:

答案 0 :(得分:2)

细胞正在重复使用。单元格被重用,不再创建以提高性能。因此,当您向下滚动时,由于您的条件检查,将禁用单元格的交互。由于没有条件来检查static void Main(string[] args) { double monthlyDeposit; double rateOfInterest; double numberOfCompounds; double years; double futureValue = 0; double totalAmount = 0; Console.WriteLine("Compound Interest Calculation based on monthly deposits"); Console.WriteLine("Monthly Deposit"); monthlyDeposit = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Rate Of Interest"); rateOfInterest = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Number of Compounds in a year"); numberOfCompounds = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Number of year"); years = Convert.ToDouble(Console.ReadLine()); futureValue = monthlyDeposit; for (int i = 1; i <= years * 12; i++) { totalAmount = futureValue * (1 + (rateOfInterest / 100) / 12); if (i == years * 12) futureValue = totalAmount; else futureValue = totalAmount + monthlyDeposit; } Console.WriteLine("Future Value is=" + futureValue); Console.ReadLine(); } //Output Compound Interest Calculation based on monthly Deposits Monthly Deposit 1500 Rate Of Interest 7.5 Number of Compounds in a year 12 Number of year 1 Future Value is=18748.2726237313 是否低于2,因此用户交互与重用的单元格保持不变(indexPath.row)。

只需对您的状况检查进行一些小修改即可解决问题。

false