ios - 请问这种带尖角的view有什么好的实现方法
伊谢尔伦
伊谢尔伦 2017-04-18 09:49:55
0
8
1272

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

répondre à tous(8)
伊谢尔伦

La solution du programmeur est de créer une vue carrée ; la couleur d’arrière-plan est la même que la couleur du cadre principal. Ensuite, faites pivoter cette vue carrée de 90 degrés. Ajouter à la boîte principale. Précisez simplement l'emplacement. Autrement dit, ce style est composé de deux vues.

左手右手慢动作

Créez une image à bulles, puis placez-y une tableView Après avoir défini les contraintes fixes et découpé l'image, pouvez-vous essayer ceci ? ?

伊谢尔伦

Vous pouvez en dessiner un, ce qui permet d'économiser des ressources de découpe, est plus efficace et facile à réutiliser.

- (UIView *)arrowView{
    if (!_arrowView) {
        // draw
        CGSize size = CGSizeMake(kDefaultArrowWeight, kDefaultArrowHeight);
        UIBezierPath *path = [[UIBezierPath alloc] init];
        [path moveToPoint:CGPointMake(size.width / 2.0, 0)];
        [path addLineToPoint:CGPointMake(0, size.height)];
        [path addLineToPoint:CGPointMake(size.width, size.height)];
        path.lineWidth = 1.0;
        
        CAShapeLayer *arrowLayer = [CAShapeLayer layer];
        arrowLayer.path = path.CGPath;
        
        _arrowView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
        _arrowView.layer.mask = arrowLayer;
        _arrowView.backgroundColor = self.contentViewBackgroundColor;
    }
    return _arrowView;
}
PHPzhong

Une imageview triangulaire est attachée à l'UIView et une tableview y est attachée. Il n'y a aucun problème avec un défilement comme celui-ci, et il n'y a aucun problème si vous souhaitez ajuster la position de imageView.

小葫芦

HTML :

<p class="test_triangle_border">
    <a href="#">三角形</a>
    <p class="popup">
        <span><em></em></span>测试
    </p>
</p>

 

CSS :

.test_triangle_border{
    width:200px;
    margin:0 auto 20px;
    position:relative;
}
.test_triangle_border a{
    color:#333;
    font-weight:bold;
    text-decoration:none;
}
.test_triangle_border .popup{
    width:100px;
    background:#cf0;
    padding:10px 20px;
    color:#333;
    border-radius:4px;
    position:absolute;
    top:30px;
    left:30px;
    border:1px solid #333;
}
.test_triangle_border .popup span{
    display:block;
    width:0;
    height:0;
    border-width:0 10px 10px;
    border-style:solid;
    border-color:transparent transparent #333;
    position:absolute;
    top:-10px;
    left:50%;/* 三角形居中显示 */
    margin-left:-10px;/* 三角形居中显示 */
}
.test_triangle_border .popup em{
    display:block;
    width:0;
    height:0;
    border-width:0 10px 10px;
    border-style:solid;
    border-color:transparent transparent #cf0;
    position:absolute;
    top:1px;
    left:-10px;
}

Ceci est une autre réponse que j'ai donnée, veuillez la modifier en fonction de vos besoins

刘奇

Il s'agit d'un contrôle exclusif pour iPad. Il s'appelle UIPopoverController.

阿神

S'il s'agit d'iOS8, vous pouvez utiliser UIPopoverPresentationController

Peter_Zhu

L'artiste a besoin d'une solution d'image

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!