小编And*_*lva的帖子

如何检测div上的内容更改事件

我试图让编辑器一切正常,直到现在,但现在我需要创建一个处理程序,可以检测div中的任何更改或在div中编辑的任何内容

<?php $row="testing content" ?>
<!-- my editor section-->
<div id="editor">
    <div id="options">
        <span><a id="iimg">Insert Image from gallery</a></span>
        <span>Upload image to gallery</span>
        <span><a id="iheading">Heading</a></span>
    </div>
    <div id="product_descriptioncontent" contenteditable="true"><?php echo $row; ?>
    </div><!-- viewable editor -->
    <input type="hidden" name="textareacontent" value="" id="textareacontent" >
    <!-- hidden field to submit values -->
</div>
<!-- end of editor section -->
<div id="imc"></div> <!-- image gallery loading section -->

<script>
$(document).ready(function(){

    $('#iheading').click(function(){
    $('#product_descriptioncontent').append('<h1>Heading</h1>');
    });

    $('#iimg').click(function(){
        $('#imc').load('imagegallery.php',function(){
        $('#gallery img').on('click',function(){
            $('#product_descriptioncontent').append('<img  src="http://localhost/sites/site_pics/otherpic/1.png"><br>&nbsp;');
    });
    });
    });
    $('#product_descriptioncontent').change(function(){
    alert("pppp");// how …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery dom

14
推荐指数
2
解决办法
6万
查看次数

NavigationView 标题中的 SwiftUI 多行文本

我怎么能让这个标题多行?

在此处输入图片说明

我曾尝试将标题文本设置为多行,甚至使用 allowedThigtening(flag: Bool) 对其进行配置,但这些选项均无效。

当前代码在这里:

import SwiftUI

struct DistributionCentersView: View {
    var dcViewModel = DistributionCenterViewModel()
    @State private var pickedSelectedData = 0
    @State private var searchTerm = ""

    init() {
        //...

    }

    var body: some View {
        NavigationView {
            VStack {
                VStack {
                    Picker(selection: $pickedSelectedData, label: Text("")){
                        Text("All").tag(0)
                        Text("Nevial").tag(1)
                        Text("Net power").tag(2)
                    }.pickerStyle(SegmentedPickerStyle())
                        .foregroundColor(Color.white)
                        .background(Color(#colorLiteral(red: 0.03921568627, green: 0.03921568627, blue: 0.03921568627, alpha: 1)))
                    SearchBar(text: $searchTerm)
                }
                .padding(.leading, 16)
                .padding(.trailing, 16)
                .padding(.top, 34)

                List {
                    ForEach (dcViewModel.distribuitionCenters){ dc in
                        ZStack { 
                            DistributionCenterCell()
                                .listRowInsets(EdgeInsets(top: …
Run Code Online (Sandbox Code Playgroud)

uinavigationcontroller ios swift navigationview swiftui

8
推荐指数
2
解决办法
2841
查看次数

SwiftUI - 当修改同一结构中的状态变量时如何避免刷新列表

我有一个主视图,其中包含带有 TabView 的主体,每个选项卡显示不同的列表。另外,我在主类的顶部声明了一个状态变量,用于控制是否必须显示类似模态的视图。

问题是,当我更改该状态变量的值时,主视图的所有主体都会用动画重新绘制。这不是所需的行为,因为我没有更改与更新该变量的列表关联的数据。

struct HomeView: View {
    @State private var selection = 0
    @State var modalShown = false //This is the problematic var that makes a list to be updated with an animation

    @EnvironmentObject var filters: UserFilters
    @EnvironmentObject var filtersViewController: FiltersViewController

    init() {
        UITabBar.appearance().backgroundColor = #colorLiteral(red: 0.03921568627, green: 0.03921568627, blue: 0.03921568627, alpha: 1)
        UITabBar.appearance().barTintColor = #colorLiteral(red: 0.03921568627, green: 0.03921568627, blue: 0.03921568627, alpha: 1)
    }

    var body: some View {
        return ZStack {
            TabView(selection: $selection){
                IncidencesView(modalShown: $modalShown) //A view that …
Run Code Online (Sandbox Code Playgroud)

ios swift swiftui

7
推荐指数
1
解决办法
3496
查看次数

如何在 SwiftUI 中正确设置辅助功能标识符?

我希望能够在我的视图堆栈上点击一个具体的按钮。为了实现这一点,首先我在我的代码中设置了一个可访问性 ID:

Button(action: {
                 withAnimation(.easeOut(duration: 1)) {
                    self.modalShown.toggle()
                 }

                }) {
                      FilterButton()
                     .accessibility(identifier: "modalFilterViewBtn")
                    }
                    .buttonStyle(PlainButtonStyle())
                }
Run Code Online (Sandbox Code Playgroud)

所以,然后在我的文本案例中,我试图寻找那个 id:

IOSElement elem1 = driver.findElementByAccessibilityId("modalFilterViewBtn");
    wait.until(ExpectedConditions.elementToBeClickable(elem1));
    elem1.click();
Run Code Online (Sandbox Code Playgroud)

我得到的结果是:无法使用给定的搜索参数在页面上找到元素。(..)

最后,如果我使用 Appium 检查器来知道我想要的元素的可访问性 ID,它似乎是另一个与我在代码中设置的名称不同的名称:

在此处输入图片说明

即使我查找具有该 id("Filter") 的元素,在我的测试用例中也找不到它。

那么,使用 SwiftUI 设置此辅助功能 ID 的正确方法是什么?

谢谢

ios appium swift xcuitest swiftui

4
推荐指数
1
解决办法
2398
查看次数

Swift4:从Firebase身份验证系统删除用户帐户

我希望能够通过uid以编程方式从Firebase删除用户帐户,但是我只能从数据库中删除它。

swift4上可以得到类似的东西吗?

Task<Void> task = FirebaseAuth.getInstance().deleteUser(uid)
    .addOnSuccessListener(aVoid -> System.out.println("Successfully deleted user."))
    .addOnFailureListener(e -> System.err.println("Error updating user: " + e.getMessage()));
Run Code Online (Sandbox Code Playgroud)

ios firebase swift

1
推荐指数
2
解决办法
2978
查看次数