小编Che*_*ile的帖子

Swift-拖动按钮从一个位置到另一个位置

我正在尝试使用UITouch将按钮从一个位置拖动到另一个位置.但是我无法拖动它.我在添加按钮目标时遇到问题...

我的代码 -

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
     let btn_swap = UIButton.buttonWithType(UIButtonType.Custom) as UIButton!
    btn_swap .setTitle("Drag Me", forState: UIControlState.Normal)
    btn_swap.backgroundColor = UIColor.yellowColor()

    btn_swap.addTarget(self, action: "wasDragged:", forControlEvents: UIControlEvents.TouchDragInside)

    btn_swap.frame = CGRectMake((self.view.bounds.size.width - 100)/2.0,
        (self.view.bounds.size.height - 50)/2.0,
        100, 50)

    self.view.addSubview(btn_swap)
    self.creation_of_btn()
 }

func wasDragged (buttn : UIButton, event :UIEvent)
{
    var touch : UITouch = event.touchesForView(buttn) . anyObject() as UITouch
    var previousLocation : CGPoint = touch .previousLocationInView(buttn)
     var location …
Run Code Online (Sandbox Code Playgroud)

swift

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

导航条隐藏不工作IOS

嗨,我是在iOS开发新的.我有一个隐藏导航栏的主屏幕.从那里,我使用回SEGUE导航到另一个视图.但是当我点击回到它显示主屏幕上的导航栏.这是我的问题描述.

在主屏幕onviewload我做的:

self.navigationController.navigationBarHidden = YES;
Run Code Online (Sandbox Code Playgroud)

一旦用户使用早在新的控制器SEGUE去另一种观点认为,我做的

self.navigationController.navigationBarHidden = NO;
Run Code Online (Sandbox Code Playgroud)

而现在,如果我点击它,它将在主窗口上显示我不想要的导航栏.基本上,我想没有导航栏和下一个窗口与导航栏主屏幕.

这该怎么做.需要帮忙.谢谢.

objective-c uinavigationcontroller

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

JSQMessagesViewController - 发送带附加图像文件的文本消息

我使用JSQMessagesViewController发送和接收消息.它适用于文本消息.是否可以使用JSQMessagesViewController Framework发送带有附加图像文件的文本消息.

单击时,应显示附加的图像文件.像这样的东西.

发送消息应在消息窗口中显示如下.

在此输入图像描述

用于发送照片

- (void)addPhotoMediaMessage
{
   JSQPhotoMediaItem *photoItem = [[JSQPhotoMediaItem alloc] initWithImage:[UIImage imageNamed:@"goldengate"]];
   JSQMessage *photoMessage = [JSQMessage messageWithSenderId:kJSQDemoAvatarIdSquires
                                               displayName:kJSQDemoAvatarDisplayNameSquires
                                                     media:photoItem];
  [self.messages addObject:photoMessage];
}
Run Code Online (Sandbox Code Playgroud)

发送短信

- (void)didPressSendButton:(UIButton *)button
       withMessageText:(NSString *)text
              senderId:(NSString *)senderId
     senderDisplayName:(NSString *)senderDisplayName
                  date:(NSDate *)date
{
    [JSQSystemSoundPlayer jsq_playMessageSentSound];
    JSQMessage *message = [JSQMessage messageWithSenderId:senderId
                                          displayName:senderDisplayName
                                                 text:text];
   [self.messages addObject:message];
   [self finishSendingMessageAnimated:YES];
   [self receiveAutoMessage];
}
Run Code Online (Sandbox Code Playgroud)

objective-c ios jsqmessagesviewcontroller

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

UIBezierPath-双向箭头与曲线

我正在尝试制作一个带有两个侧箭头标记和中间弧形曲线的箭头

但是现在我已经使用了mayOff_gist并能够使一侧带有单线箭头。

码-

//。H

@interface UIBezierPath (arrow)


+ (UIBezierPath *)dqd_bezierPathWithArrowFromPoint:(CGPoint)startPoint
                                       toPoint:(CGPoint)endPoint
                                     tailWidth:(CGFloat)tailWidth
                                     headWidth:(CGFloat)headWidth
                                    headLength:(CGFloat)headLength;


@end
Run Code Online (Sandbox Code Playgroud)

//.m

#define kArrowPointCount 7

@implementation UIBezierPath (arrow)


+ (UIBezierPath *)dqd_bezierPathWithArrowFromPoint:(CGPoint)startPoint
                                       toPoint:(CGPoint)endPoint
                                     tailWidth:(CGFloat)tailWidth
                                     headWidth:(CGFloat)headWidth
                                    headLength:(CGFloat)headLength {
CGFloat length = hypotf(endPoint.x - startPoint.x, endPoint.y - startPoint.y);

CGPoint points[kArrowPointCount];
[self dqd_getAxisAlignedArrowPoints:points
                          forLength:length
                          tailWidth:tailWidth
                          headWidth:headWidth
                         headLength:headLength];

CGAffineTransform transform = [self dqd_transformForStartPoint:startPoint
                                                      endPoint:endPoint
                                                        length:length];

CGMutablePathRef cgPath = CGPathCreateMutable();
CGPathAddLines(cgPath, &transform, points, sizeof points / sizeof *points);
CGPathCloseSubpath(cgPath);

UIBezierPath *uiPath = [UIBezierPath bezierPathWithCGPath:cgPath];
CGPathRelease(cgPath);
return uiPath;
}

+ (void)dqd_getAxisAlignedArrowPoints:(CGPoint[kArrowPointCount])points
                        forLength:(CGFloat)length
                        tailWidth:(CGFloat)tailWidth …
Run Code Online (Sandbox Code Playgroud)

objective-c uibezierpath

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

UITableView的不向下滚动和反弹

我有2次:一种是main view在其内我生成一个酥料饼,其中表视图将被显示.我在table view里面使用.popoverController我的popover大小是(700,264).我有吨表视图,即不同的厦门国际银行PopovertableView Controller.我设置我的表尺寸(0,0.700,352),并给予行高为44.我userlistTable中有8个目标.我没有得到什么错误,我已经尝试设置我的桌子的高度超过352

这是我的代码

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{    
 NSLog(@"row in table");
 NSLog(@"numberOfRowsInSection returning %d", [userlistTable count]);
 return [ userlistTable count];
}
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{

 if(textField == universityTextField)
    {
     if(popOverController == nil)
            {
                PopoverTableViewController *popovertableViewController=     [[PopoverTableViewController alloc]init];

                self.popOverController  = [[UIPopoverController alloc] initWithContentViewController:popovertableViewController];

             }

       popOverController.popoverContentSize = CGSizeMake(700,264);
       [popOverController presentPopoverFromRect:CGRectMake(40, 268, 410, 46) inView:textField.superview permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
    }

return NO;
}
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview ios

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

如何从itunes connect中删除应用程序,这是在准备提交阶段

我在Itunes Connect上传了一个新的应用程序并保存了一些应用程序名称,图标等细节.

我没有提交它进行审核,只是保存了详细信息.现在我看不到任何删除当前应用程序的选项.

请建议我!!

itunesconnect app-store ios

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