0
我想添加此功能來選擇我的導航欄的標題,然後查找顯示彈出式視圖,其中顯示另一個視圖。在Facebook的照片選擇器中發生了什麼。如何編程我的導航欄的標題以顯示此新視圖? 如何在導航欄的標題項上添加專輯選擇器視圖
我想添加此功能來選擇我的導航欄的標題,然後查找顯示彈出式視圖,其中顯示另一個視圖。在Facebook的照片選擇器中發生了什麼。如何編程我的導航欄的標題以顯示此新視圖? 如何在導航欄的標題項上添加專輯選擇器視圖
您應該設計自定義類的UIView,並設置下面的代碼:
#import "popoverView.h"
@implementation popoverView
- (void)drawRect:(CGRect)rect {
self.layer.cornerRadius=6.0;
CGFloat margian=20;
[self addpathAtPoint:CGPointMake(margian, margian) andEndPoint:CGPointMake(sqrtf(margian*margian+margian*margian), 0.0)];
[self addpathAtPoint:CGPointMake(sqrtf(margian*margian+margian*margian), 0.0) andEndPoint:CGPointMake(2*margian, margian)];
[self addpathAtPoint:CGPointMake(2*margian, margian) andEndPoint:CGPointMake(rect.size.width-2*margian, margian)];
[self addCurveToPoint:CGPointMake(rect.size.width-2*margian, margian) endPoint:CGPointMake(rect.size.width-margian, 2*margian) controlPoint1:CGPointMake(rect.size.width-margian, margian) controlPoint2:CGPointMake(rect.size.width-margian, margian)];
[self addpathAtPoint:CGPointMake(rect.size.width-margian, 2*margian) andEndPoint:CGPointMake(rect.size.width-margian, rect.size.height-2*margian)];
[self addCurveToPoint:CGPointMake(rect.size.width-margian, rect.size.height-2*margian) endPoint:CGPointMake(rect.size.width-2*margian, rect.size.height-margian) controlPoint1:CGPointMake(rect.size.width-margian, rect.size.height-margian) controlPoint2:CGPointMake(rect.size.width-margian, rect.size.height-margian)];
[self addpathAtPoint:CGPointMake(rect.size.width-2*margian, rect.size.height-margian) andEndPoint:CGPointMake(2*margian,rect.size.height-margian)];
[self addCurveToPoint:CGPointMake(2*margian,rect.size.height-margian) endPoint:CGPointMake(margian,rect.size.height-2*margian) controlPoint1:CGPointMake(margian, rect.size.height-margian) controlPoint2:CGPointMake(margian, rect.size.height-margian)];
[self addpathAtPoint:CGPointMake(margian,rect.size.height-2*margian) andEndPoint:CGPointMake(margian,margian)];
}
-(void)addpathAtPoint:(CGPoint)startPoint andEndPoint:(CGPoint)endPoint{
UIBezierPath *path=[UIBezierPath bezierPath];
path.lineWidth=3.0;
[path moveToPoint:startPoint];
[path addLineToPoint:endPoint];
[[UIColor blackColor] setStroke];
[path stroke];
[path closePath];
}
-(void)addCurveToPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint controlPoint1:(CGPoint)controlPoint1 controlPoint2:(CGPoint)controlPoint2
{
UIBezierPath *path=[UIBezierPath bezierPath];
path.lineWidth=3.0;
[path moveToPoint:startPoint];
[path addCurveToPoint:endPoint controlPoint1:controlPoint1 controlPoint2:controlPoint2];
[[UIColor blackColor]setStroke];
[path stroke];
}