在UITextField中定位可输入区域

时间:2016-02-20 13:35:59

标签: ios swift uitextfield

默认情况下,UITextField的可键入区域位于" vertical-center",就像这样

enter image description here

如何将可打字区域定位到底部,但是底部有填充/偏移?

1 个答案:

答案 0 :(得分:1)

您可以覆盖private class MyPagerAdapter extends PagerAdapter { @Override public int getCount() { return numCap; } @Override public Object instantiateItem(ViewGroup container, int position) { LayoutInflater inflater = (LayoutInflater) container.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); final ListView list = (ListView) inflater.inflate(R.layout.capitulo, null); //set the chapter you left off at, in case you change orientation s.setCap(position); //Load content listll(position); //Display it list.setAdapter(new CapituloAdapter(getApplicationContext(), R.layout.content_main, ll)); ((ViewPager) container).addView(list, 0); //Only shows when position is any item from the first to the next to last, doesn't show for last item Log.v(TAG, "Finished my pager adapter object" + (position-1)); return list; } //more code here... 的{​​{1}},textRectForBounds(_:)placeholderRectForBounds(_:)方法来自定义文字位置,并与设置为editingRectForBounds(_:)的{​​{1}}结合使用

假设您希望文本有10个点填充:

UITextField