我有一个表格视图,其中自定义单元格在委托函数didHighlightRowAt
和didUnhighlightRowAt
中定义了自定义突出显示样式(例如,我改变了背景颜色)。
然而,当我选择一个单元格时,会立即触发取消高亮显示功能 - 我该如何避免这种情况?我希望单元格保持高亮显示,而不是在viewwillappear中取消它。
谢谢!
[我将tableView.selectionStyle
设置为.none
,因为这是在不使用标准选择样式的情况下进行自定义突出显示的唯一方法。这可能是问题吗?]
答案 0 :(得分:0)
好的,我已经解决了这个问题,但是我认为我的解决方案更像是一种解决方案,所以更好的方法仍然受到高度赞赏!
看起来流程如下:
<div class="dnt-container-mobile seasonal-bg-dark">
<h1 class="mobile-heading">Dog Name Finder</h1>
<h1 class="wide-heading"><!-- <span class="logo teal icon-akc-logo dnt-logo"></span> -->Dog Name Finder</h1>
<form class="dnt-tool" id="dnt" name="dnt">
<div class="dnt-overlay">
<input id="male" name="gender" type="radio" value="Male" />
<label for="male">Male</label>
<input data-id="594" id="female" name="gender" type="radio" value="Female" />
<label for="female">Female</label>
<input checked="checked" data-id="0" id="all" name="gender" type="radio" value="All" />
<label for="all">All</label>
<select>
<option data-id="0" value="/dog-name-finder/">Select a Category</option>
<option data-id="0" value="/dog-name-finder/">All</option>
<option value="/dog-name-finder/baby/">Baby</option>
<option data-id="602" value="/dog-name-finder/celebrity/">Celebrity</option>
<option data-id="603" value="/dog-name-finder/cute/">Cute</option>
<option data-id="598" value="/dog-name-finder/disney/">Disney</option>
<option data-id="600" value="/dog-name-finder/fancy/">Fancy</option>
<option data-id="605" value="/dog-name-finder/most-popular/">Most Popular</option>
<option data-id="599" value="/dog-name-finder/presidential/">Presidential</option>
<option data-id="597" value="/dog-name-finder/techy/">Techy</option>
<option data-id="596" value="/dog-name-finder/television/">Television</option>
<option data-id="606" value="/dog-name-finder/trendy/">Trendy</option>
<option data-id="595" value="/dog-name-finder/unisex/">Unisex</option>
<option data-id="604" value="/dog-name-finder/video-game/">Video Game</option>
</select>
</div><!-- end of dnt-overlay -->
<div class="dnt-btn">
<button id="submit" type="submit">Show Names</button>
</div><!-- end of dnt btn -->
</form><!-- end of dnt-tool -->
</div><!-- end of dnt-container-mobile -->
<div class="white-popup mfp-hide" id="dnt-popup">
<div class="popup-logo">
<a class="logo teal icon-logo"></a>
</div><!-- end of logo -->
<h1>Most Popular Dog Names</h1>
<img src="gender-all.png" id="dnt-all-img" alt=
all puppies">
<img src="female-puppy.png" id="dnt-female-img" alt="Female puppy">
<img src="male-puppy.png" id="dnt-male-img" alt="Male puppy">
<div class="results-list">
<ul>
</ul>
</div><!-- end of results list -->
<div class="more-btn">
<div class="short-btn"><a href="/dog-name/">Tap to See More Names</a></div>
<div class="long-btn"><a href="/dog-name/">Get More Names on Dog Name Finder</a></div>
</div><!-- end of dnt btn -->
所以我所做的是在取消照明后,再次手动突出显示该单元格,然后在viewWillAppear
中