首页 \ 问答 \ 如何仅在UITableView的底部添加阴影?(How to add shadow only at the bottom of section of UITableView?)

如何仅在UITableView的底部添加阴影?(How to add shadow only at the bottom of section of UITableView?)

我有一个分段的UITableView ,它有一个高度为10的头部,它有backgroundColor作为clearColor只是为了显示更分离的部分。 现在我只需要在每个部分的底部添加阴影。 我已经尝试向viewForHeaderInSection方法添加阴影,但结果非常糟糕。 任何提示实现这一目标?

func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
    let shadowView = UIView()

    shadowView.layer.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5).CGColor
    shadowView.layer.shadowOffset = CGSizeMake(0.0, 2.0)
    shadowView.layer.shadowOpacity = 1.0
    shadowView.layer.shadowRadius = 0.0
    shadowView.layer.masksToBounds = false

    return shadowView
}

func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
    return 2
}

I have a sectioned UITableView which has a header of height 10 and it has backgroundColor as clearColor just to show the sections more separated. Now I need to add a shadow only at the bottom of each section. I've tried adding shadow to the viewForHeaderInSection method, but the result is very bad. Any tips for achieving this?

func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
    let shadowView = UIView()

    shadowView.layer.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5).CGColor
    shadowView.layer.shadowOffset = CGSizeMake(0.0, 2.0)
    shadowView.layer.shadowOpacity = 1.0
    shadowView.layer.shadowRadius = 0.0
    shadowView.layer.masksToBounds = false

    return shadowView
}

func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
    return 2
}

原文:https://stackoverflow.com/questions/40026892
更新时间:2024-04-22 14:04

最满意答案

autocomplete属性或属性仅限于input元素,这些元素都是根据Microsoft对该功能的描述以及根据HTML5草案描述来标准化该功能的。 因此,您应该期望浏览器忽略其他元素,包括textarea

显然, autocomplete不是真正的问题,只是假设的方法,这是一个错误的方法。 但真正的问题并没有真正描述过。


The autocomplete attribute or property is limited to input elements, both according to Microsoft description of the feature and according to the HTML5 draft description proposed to standardize the feature. So you should expect browsers to ignore it for other elements, including textarea.

Apparently, autocomplete is not the real question, just an assumed approach, which is a wrong one. But the real problem was not really described.

相关问答

更多
  • 那么有一个自动完成插件就是这样做的,如果你想从数据库中提取数据,我推荐使用jQuery中包含的ajax API 。 像这样的东西 $('textarea').keyup(function(){ $.post('ajax/test.php', function(data) { $('#example').autocomplete(data); }); }); 另外请记住,这只是给你一个想法的基本结构。 PS我刚刚发现它应该满足您的所有需求。 Well there is the autoc ...
  • 我确定你的问题很久以来解决了,但是jquery-textcomplete看起来像这样做。 I could not find any solution that matched my requirements perfectly, so I ended up with the following: I use the jQuery keypress() event to check for the user pressing the @ character. If this is the case, a mo ...
  • 将$(':text')更改$(':text') $('input[type="text"], textarea') 或者,这个现有的jQuery插件: https://github.com/mathiasbynens/jquery-placeholder 适用于textareas和许多类型的输入字段,包括密码字段 Change $(':text') to $('input[type="text"], textarea') Alternatively, this existing jQuery plugin: ...
  • 只需添加您的textarea : display: inherit; CSS .message_content textarea { font-size: 14px; color: grey; height: 200px; margin: 0; resize: none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; display: inherit; /*Add this*/ } ...
  • 尝试 function some_log(thought) { $("#some-log").val(function(){ return this.value + thought + ','; }); } 演示: 小提琴 Try function some_log(thought) { $("#some-log").val(function(){ return this.value + thought + ','; }); } Demo: ...
  • 您可以使用setAttribute重置在调整大小期间自动添加的style属性: document.getElementById('reset').onclick = function(){ var textarea = document.getElementById('target'); textarea.setAttribute('style',''); textarea.value = ""; } '; } } 如果Type属性=='textarea',此代码段将循环您的对象并覆盖HTMLTemplate属性。 但是为什么 ...
  • 以下是我发现的三个JavaScript插件,它们用于我正在寻找的目的: jQuery的textcomplete.js At.js triggeredAutocomplete.js Following are the three JavaScript plugins I found which serves the purpose I am looking for: jQuery-textcomplete.js At.js triggeredAutocomplete.js
  • autocomplete属性或属性仅限于input元素,这些元素都是根据Microsoft对该功能的描述以及根据HTML5草案描述来标准化该功能的。 因此,您应该期望浏览器忽略其他元素,包括textarea 。 显然, autocomplete不是真正的问题,只是假设的方法,这是一个错误的方法。 但真正的问题并没有真正描述过。 The autocomplete attribute or property is limited to input elements, both according to Micr ...
  • 您还可以查看Spiffy UI中的多值自动完成程序。 这是z00bs提到的auto-completer的更新版本,也是这个可重用框架的一部分。 You also might want to check out the multi-value auto-completer from Spiffy UI. This is a newer version of the auto-completer mentioned by z00bs and part of this reusable framework.

相关文章

更多

最新问答

更多
  • 带有简单redis应用程序的Node.js抛出“未处理的错误”(Node.js with simple redis application throwing 'unhandled error')
  • 高考完可以去做些什么?注意什么?
  • Allauth不会保存其他字段(Allauth will not save additional fields)
  • Flask中的自定义中止映射/异常(Custom abort mapping/exceptions in Flask)
  • sed没有按预期工作,从字符串中间删除特殊字符(sed not working as expected, removing special character from middle of string)
  • 怎么在《我的世界》游戏里面编程
  • .NET可移植可执行文件VS .NET程序集(.NET Portable Executable File VS .NET Assembly)
  • 搜索字符串从视图中键入两个字段的“名字”和“姓氏”组合(Search Strings Typed from View for Two Fields 'First Name' and 'Last Name' Combined)
  • 我可以通过配置切换.Net缓存提供程序(Can I switch out .Net cache provider through configuration)
  • 在鼠标悬停或调整浏览器大小之前,内容不会加载(Content Does Not Load Until Mouse Hover or Resizing Browser)
  • 未捕获的TypeError:auth.get不是函数(Uncaught TypeError: auth.get is not a function)
  • 如何使用变量值创建参数类(How to create a parameter class with variant value)
  • 在std :: deque上并行化std :: replace(Parallelizing std::replace on std::deque)
  • 单元测试返回Connection对象的方法(Unit Test for a method that returns a Connection object)
  • rails:上传图片时ios中的服务器内部错误(rails: server internal error in ios while uploading image)
  • 如何在Android中构建应用程序警报[关闭](How build an application Alarm in Android [closed])
  • 以编程方式连接到Windows Mobile上的蓝牙耳机(Programmatically connect to bluetooth headsets on Windows Mobile)
  • 在两个不同的SharedPreference中编写并获得相同的结果(Writing in two different SharedPreference and getting the same result)
  • CSS修复容器和溢出元素(CSS Fix container and overflow elements)
  • 在'x','y','z'迭代上追加数组(Append array on 'x', 'y', 'z' iteration)
  • 我在哪里可以看到使用c ++源代码的UML方案示例[关闭](Where I can see examples of UML schemes with c++ source [closed])
  • SQL多个连接在与where子句相同的表上(SQL Multiple Joins on same table with where clause)
  • 位字段并集的大小,其成员数多于其大小(Size of bit-field union which has more members than its size)
  • 我安装了熊猫,但它不起作用(I installed pandas but it is not working)
  • Composer - 更改它在env中使用的PHP版本(Composer - Changing the version of PHP it uses in the env)
  • 使用JavaFX和Event获取鼠标位置(Getting a mouse position with JavaFX and Event)
  • 函数调用可以重新排序(Can function calls be reordered)
  • 关于“一对多”关系的NoSQL数据建模(NoSQL Data Modeling about “one to many” relationships)
  • 如何解释SBT错误消息(How to interpret SBT error messages)
  • 调试模式下的Sqlite编译器错误“初始化程序不是常量”(Sqlite compiler errors in Debug mode “initializer is not a constant”)