隐藏其他字段时填写两个文本字段之间的间隙

时间:2016-03-08 04:29:53

标签: ios objective-c cocoa-touch layout

我在表单页面中有一些文本字段:

package com.example;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.TimeUnit;

public class TimeShow
{
    public static void main(String[] args) {
        try 
        {
            SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd G 'at' HH:mm:ss");
            Date past = format.parse("2016.02.05 AD at 23:59:30");
            Date now = new Date();
            long seconds=TimeUnit.MILLISECONDS.toSeconds(now.getTime() - past.getTime());
            long minutes=TimeUnit.MILLISECONDS.toMinutes(now.getTime() - past.getTime());
            long hours=TimeUnit.MILLISECONDS.toHours(now.getTime() - past.getTime());
            long days=TimeUnit.MILLISECONDS.toDays(now.getTime() - past.getTime());
//
//          System.out.println(TimeUnit.MILLISECONDS.toSeconds(now.getTime() - past.getTime()) + " milliseconds ago");
//          System.out.println(TimeUnit.MILLISECONDS.toMinutes(now.getTime() - past.getTime()) + " minutes ago");
//          System.out.println(TimeUnit.MILLISECONDS.toHours(now.getTime() - past.getTime()) + " hours ago");
//          System.out.println(TimeUnit.MILLISECONDS.toDays(now.getTime() - past.getTime()) + " days ago");

            if(seconds<60)
            {
                System.out.println(seconds+" seconds ago");
            }
            else if(minutes<60)
            {
                System.out.println(minutes+" minutes ago");
            }
            else if(hours<24)
            {
                System.out.println(hours+" hours ago");
            }
            else 
            {
                System.out.println(days+" days ago");
            }
        }
        catch (Exception j){
            j.printStackTrace();
        }
    }
}

当我用

隐藏某些字段时
 acquiredThroughLone.text=[acquitionArray objectAtIndex:row];
assetsTypeApprectitiveorDepriciateTxtFld.text=[appriciateArray objectAtIndex:row];
purchasedOrGirftTextFld.text=[purchaseArray objectAtIndex:row];
 assetsCategoryTextFld.text=[assetsCategorySplitDisplayArray objectAtIndex:row];

我在剩下的文本字段之间出现差距。我怎样填补空白?

1 个答案:

答案 0 :(得分:0)

获取所有textFields IBOutlet高度限制 (不要使用TextFields Border Style默认值)

enter image description here

@property (strong, nonatomic) IBOutlet NSLayoutConstraint *text1HeightConstraints;

if([acquitionArray objectAtIndex:row] != nil)
{
   self.text1HeightConstraints.constant=30;
   acquiredThroughLone.text=[acquitionArray objectAtIndex:row];
}
 else
{
    self.text1HeightConstraints.constant=0;
}