小编Ale*_*xis的帖子

如何使用jQuery检查单选按钮?

我尝试用jQuery检查一个单选按钮.这是我的代码:

<form>
    <div id='type'>
        <input type='radio' id='radio_1' name='type' value='1' />
        <input type='radio' id='radio_2' name='type' value='2' />
        <input type='radio' id='radio_3' name='type' value='3' /> 
    </div>
</form>
Run Code Online (Sandbox Code Playgroud)

和JavaScript:

jQuery("#radio_1").attr('checked', true);
Run Code Online (Sandbox Code Playgroud)

不起作用:

jQuery("input[value='1']").attr('checked', true);
Run Code Online (Sandbox Code Playgroud)

不起作用:

jQuery('input:radio[name="type"]').filter('[value="1"]').attr('checked', true);
Run Code Online (Sandbox Code Playgroud)

不起作用:

你有其他想法吗?我错过了什么?

javascript forms jquery radio-button

853
推荐指数
20
解决办法
129万
查看次数

UITableViewCell中iOS7上的自动布局约束问题

我正在以编程方式使用自动布局约束来布局我的自定义UITableView单元格,并且我正确地定义了单元格大小 tableView:heightForRowAtIndexPath:

它在iOS6上运行得很好,在iOS7中看起来也很好

但是当我在iOS7上运行应用程序时,这是我在控制台中看到的那种消息:

Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2013-10-02 09:56:44.847 Vente-Exclusive[76306:a0b] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or …
Run Code Online (Sandbox Code Playgroud)

uitableview ios autolayout nslayoutconstraint ios7

104
推荐指数
4
解决办法
6万
查看次数

证书受PC信任,但不受Android信任

从今天早上起,我的证书在Android上不再受信任,然后我的应用程序再也无法连接:

 Catch exception while startHandshake: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
 return an invalid session with invalid cipher suite of SSL_NULL_WITH_NULL_NULL
 javax.net.ssl.SSLPeerUnverifiedException: No peer certificate
    at org.apache.harmony.xnet.provider.jsse.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:137)
    at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:93)
    at org.apache.http.conn.ssl.SSLSocketFactory.createSocket(SSLSocketFactory.java:381)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:165)
    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:591)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:807)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:781)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:770)
Run Code Online (Sandbox Code Playgroud)

如果我尝试在谷歌浏览器(在PC上)没有问题,证书是可信的,但如果我在Android上使用Chrome浏览器,它会告诉我证书不受信任.我能做什么?

android ssl-certificate

81
推荐指数
3
解决办法
11万
查看次数

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

在创建Android通知时,在PendingIntent中使用FLAG_UPDATE_CURRENT时会复制intent附加内容

我想创建几个启动活动(或刷新它)以显示产品描述的通知.

Notification notification = new Notification(R.drawable.applicationicon,
            Resources.getString("NewSaleNotification", context),
            System.currentTimeMillis());
// Hide the notification after its selected
notification.flags |= Notification.FLAG_AUTO_CANCEL;

Intent intent = new Intent(context, MainApplication.class);
intent.putExtra("saleid", saleid);

// to be sure the activity won't be restarted
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent,
            PendingIntent.FLAG_UPDATE_CURRENT);
notification.setLatestEventInfo(context, SaleTitle, SaleMessage, pendingIntent);
notificationManager.notify(saleid, notification);
Run Code Online (Sandbox Code Playgroud)

当我创建PendingIntent时,我有4个选择:FLAG_CANCEL_CURRENT,FLAG_NO_CREATE,FLAG_ONE_SHOT和FLAG_UPDATE_CURRENT.

最后一个(http://developer.android.com/reference/android/app/PendingIntent.html#FLAG_UPDATE_CURRENT)的定义是我想要做的,但它不能正常工作.如果我创建2个通知,它们都具有相同的'saleid'额外,这是最新的.如何使用不同的'saleid'额外制作多个通知?

notifications android android-intent

19
推荐指数
1
解决办法
7854
查看次数

键盘出现时如何使android视图可滚动?

我有一些视图(名称,电子邮件,密码,注册按钮):

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <ViewFlipper
        android:id="@+id/viewflipper"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        //Layouts

    </ViewFlipper>

</ScrollView>
Run Code Online (Sandbox Code Playgroud)

当我关注edittext字段时,键盘出现并覆盖视图上的下部字段.所以当键盘存在时我看不到它们.我想知道如何使视图可滚动,以便我可以看到较低的字段.此外,如何使视图自动滚动以使聚焦的字段可见.

android android-keypad android-layout android-scrollview

15
推荐指数
2
解决办法
3万
查看次数

是否已经可以在 react-native 中使用顶级 await?

是否已经可以在 react-native 中使用顶级 await?我看到它已被添加到 TypeScript 3.8(我没有使用 TS,我只是想看看它是否有帮助,但没有)。然而,在 react-native 文件转换是由 babel 处理的,我认为当前的 Metro 预设不能处理顶级等待。有没有办法让它工作?

async-await typescript babeljs react-native metro-bundler

15
推荐指数
1
解决办法
655
查看次数

在ios中使用关键帧动画时如何设置动画曲线?

使用UIView的关键帧动画时如何设置动画曲线:

animateKeyframesWithDuration:delay:options:animations:completion:
Run Code Online (Sandbox Code Playgroud)

无论我在动画块中做什么似乎是线性的(除非我使用该UIViewKeyframeAnimationOptionCalculationModeCubic选项,但这不是我想要的).

我想在动画中UIViewAnimationOptionCurveEaseOut使用缓动曲线,就像使用常规动画时的选项一样:

animateWithDuration:delay:options:animations:completion:
Run Code Online (Sandbox Code Playgroud)

animation core-animation ios ios7

13
推荐指数
5
解决办法
1万
查看次数

使用iOS 8 SDK构建时,iOS 7上的UICollectionViewCell大小调整问题:这是一个错误吗?

我开始为iOS 8构建我的iOS应用程序,并且我很快发现UICollectionViewCell存在问题,无论您使用自定义集合布局与否.许多细胞没有正确显示,内容被切断等.

快速修复:将以下自动调整遮罩添加到单元格的内容视图中:

self.contentView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
Run Code Online (Sandbox Code Playgroud)

当我使用iOS 7 SDK构建时,这种情况不会发生.使用iOS 8 SDK构建并在iOS 8上运行时也不会发生这种情况.

这是一个bug还是iOS 8之后还有什么不同的地方?

uikit uicollectionview uicollectionviewcell ios7 ios8

13
推荐指数
1
解决办法
834
查看次数

如何计算具有固定宽度的UILabel的行数?

如何计算具有固定宽度和给定文本的UILabel的行数?

uilabel ios

12
推荐指数
1
解决办法
3万
查看次数