为什么不将shadowImage设置为nil适用于iOS 11?

时间:2017-12-28 09:32:18

标签: ios swift uinavigationbar

我有一个导航栏,prefersLargeTitles设置为True。 单击表格视图中的单元格以显示详细视图时,我希望导航栏使用以下内容变为透明,这样可以正常工作:

self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true

按详细视图上的后退按钮返回主视图控制器时,我调用:

self.navigationController?.navigationBar.setBackgroundImage(nil, for: UIBarMetrics.default)
self.navigationController?.navigationBar.shadowImage = nil

不幸的是,导航栏的阴影视图不会返回,如下所示。我错过了什么?

Initial

enter image description here

1 个答案:

答案 0 :(得分:0)

这是在Xcode 10.1和iOS 12.1中对我有效的方法。

@Entity(name = "question")
public class Question extends DateAudit {
    @Id
    @Column(name = "question_id")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "question_seq")
    @SequenceGenerator(name = "question_seq", allocationSize = 1)
    private Long id;
    private boolean isAnswered;

    /* TOPIC AND SUBTOPIC, create class Topic. */
    private Topic topic;
    private Topic subtopic; //Or you have a subtopic in Topic class

    @Column(name = "text_question")
    private String textQuestion; // The question itself "What's the name of ..."

    /* question types. All have to have their own class. When admin create quetion he will add one question type --  setMultiChoice()
     * Another ones are NULL so when you create answer form it selects that what is not NULL */
    private MultiChoise multiChoise;
    private NormalQuestion normalQuestion;
    /* etc question types */

    @Column(name = "answerDescription")
    @NotBlank(message = "Answer description")
    private String answerDescription; // The answer to the question as an explanation

    @Column(name = "isExamQuestion", nullable = false)
    private Boolean isExamQuestion; // A flag for the user to filter when he wants to do a question he only will see
                                    // those that are not isExamQuestion, isExamQuestion are the questions that are
                                    // going to appear when he wants to create a Quiz


}



@Entity
public class MultiChoice extends Points{
    private List<TextAndBoolean> choices;
    private boolean answered;

}



 public class Points {
    private double points;

}


public class TextAndBoolean {
    private String text;
    private boolean selected;

}