小编Nig*_*ury的帖子

CALayer作为SubLayer不可见

我正在尝试构建一个动画圆圈,它将顺时针绘制,直到它变成完整的圆圈,如iPhone核心动画 - 绘制圆圈所示

问题是CALayer没有添加或构建对象.我测试过并发现它没有访问我drawInContext:CGContextRefanimatingArc方法.

到目前为止我所做的是:

在AnimateArc.h中

@interface AnimateArc : CALayer {

CAShapeLayer *circle;
}

-(void) animatingArc;

@end
Run Code Online (Sandbox Code Playgroud)

在AnimateArc.m中

-(void) drawInContext:(CGContextRef)ctx
{
CGFloat radius = 50.0;
circle = [CAShapeLayer layer];

//make a circular shape
circle.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0.0, 0.0, 2 * radius, 2 * radius) cornerRadius:radius].CGPath;

    CGPoint centerPoint = CGPointMake(CGRectGetWidth(self.bounds)/2, CGRectGetHeight(self.bounds)/2);    

//center the shape in self.view
circle.position = centerPoint;

//configure appearence of circle
circle.fillColor = [UIColor clearColor].CGColor;
circle.strokeColor = [UIColor blackColor].CGColor;
circle.lineWidth = 5; …
Run Code Online (Sandbox Code Playgroud)

invisible core-animation ios4 quartz-core

5
推荐指数
2
解决办法
7536
查看次数

如何在Xcode 6上设置svn存储库?

我刚开始使用Xcode并尝试在远程Windows服务器上添加Subversion存储库.当我输入Subversion存储库的位置路径时,它显示以下错误消息:

错误信息 :

"主机无法访问."

请任何人可以帮忙吗?谢谢.

svn ios xcode6

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

Facebook SDK 4.x权限问题iOS

我正在尝试为登录用户的时间线获取Feed.我有一个登录按钮,我通过读取权限,包括user_posts.令人惊讶的是,Facebook没有授予我这个许可,而忽略了它.

码:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    self.loginButton.readPermissions = @[@"public_profile", @"email", @"user_friends", @"user_posts"];

    self.loginButton.delegate = self;

    if([FBSDKAccessToken currentAccessToken])
    {
        NSLog(@"Have access token");
        NSLog(@"permissions .... %@",[FBSDKAccessToken currentAccessToken].permissions);
        [self retrieveFeed];
    }

}

#pragma mark - Login Delegate

-(void) loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error
{
    NSLog(@"Login Successfully!!");
    NSLog(@"permissions .... %@",[FBSDKAccessToken currentAccessToken].permissions);

    [self retrieveFeed];

}

-(void) loginButtonDidLogOut:(FBSDKLoginButton *)loginButton
{

}

#pragma mark - Receive FB Feed …
Run Code Online (Sandbox Code Playgroud)

facebook facebook-graph-api ios

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

重新加载ListView不工作React Native

重新措辞我的问题......(用单独的课程测试)

我试图listview按下按钮随机阵列重新加载.但它不起作用!尝试datasource使用以下LOC 刷新它:

_buttonPressed() {
        this.setState({
            dataSource: this.state.dataSource.cloneWithRows(this._randomArray()),
        });
    }

_randomArray() {

    var jsonRes;

    switch(this.getRandomInt()) // number returned is valid. I checked
    {
        case 1:
        {
            jsonRes = '[' +
            '{ "firstName":"Michel" , "lastName":"John" ,"age":18},' +
            '{ "firstName":"Richard" , "lastName":"Joe","age":20 },' +
            '{ "firstName":"James" , "lastName":"Henry","age":15 },' +
            '{ "firstName":"e" , "lastName":"u","age":15 }]';
            break;
        }
        case 2:
        {
            jsonRes = '[' +
            '{ "firstName":"bacde" , "lastName":"John" ,"age":18},' +
            '{ "firstName":"bacde" , "lastName":"Joe","age":20 },' +
            '{ "firstName":"bacde" …
Run Code Online (Sandbox Code Playgroud)

listview datasource ecmascript-6 react-native

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

如何在不关闭 Android 的情况下从 PopupMenu 显示子菜单

我有 Java 显示弹出菜单功能和下面的 xml 它可以工作,但是当用户单击主项目时,我想同时显示最小菜单和子菜单。例如当用户点击价格显示价格的子项时,不隐藏主要的价格或产品类型...,如果点击产品类型显示产品类型的子项但不隐藏主要。

这是我期望的结果。

在此处输入图片说明

显示弹出菜单java

//Filter Menu
    public void showPopupMenu(View view) {
        // inflate menu
        android.widget.PopupMenu popup = new PopupMenu(getApplicationContext(), view);
        MenuInflater inflater = popup.getMenuInflater();
        inflater.inflate(R.menu.dailydeal_filter, popup.getMenu());
        //popup.setOnMenuItemClickListener(new MyMenuItemClickListener());
        popup.show();
    }
Run Code Online (Sandbox Code Playgroud)

这是我的 xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/category"
        android:title="Price">
        <menu>
            <item android:title="Price From 10-100"></item>
            <item android:title="Price From 100-200"></item>
            <item android:title="Price From 200-300"></item>
            <item android:title="Price Higher then 300"></item>
        </menu>
    </item>

    <item android:id="@+id/type_product"
        android:title="Type Product">
        <menu>
            <item android:title="Buy Sale"></item>
            <item android:title="Business Directory"></item>
        </menu>
    </item>
</menu>
Run Code Online (Sandbox Code Playgroud)

android popupmenu

5
推荐指数
0
解决办法
773
查看次数

隐藏UITabBarController中的顶部栏

如何使用OBJ-C代码隐藏UITabBarController中的顶部栏(不使用Interface Builder)?

请参阅以下链接中的图片以更好地了解我的要求.

http://skitch.com/jugsvn/dxkr7/iphone-simulator

我已经有了另一个工具栏,你可以看到,我不想要这个.我没有使用XIB/NIB文件并使用普通的OBJ-C代码创建所有对象.

干杯水壶

iphone objective-c ios

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

UITableviewcontroller中的UITableview - 在重新加载时不调用cellforrowatindexpath

两天以来,我陷入了一个愚蠢的问题.我有一个UITableViewController推进Navigation Controller.加载时,由于没有数据,因此可以看到空表:

但是,当我收到来自服务器的数据,并调用[self.tableView reloadData],都numberOfRowsInSectionheightForRowAtIndexPath得到调用,除了cellForRowAtIndexPath和我的控制器显示为无表:

我真的不明白为什么会这样.除了之外,调用所有数据源方法cellForRowAtIndexPath.请有人指导我......谢谢..

ActLogController.h

@interface ActLogController : UITableViewController<ASIHTTPRequestDelegate,UITableViewDataSource,UITableViewDelegate>

@property(strong) NSMutableArray *activityKeys;

@end
Run Code Online (Sandbox Code Playgroud)

ActLogController.m

- (void)viewDidLoad
{
    [super viewDidLoad];

    activityKeys = [[NSMutableArray alloc] init];
    self.tableView.dataSource = self;
}

-(void) viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self retrieveActivityLogFromServer];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return activityKeys.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell …
Run Code Online (Sandbox Code Playgroud)

reload uitableview ios

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

iOS 7:在textfield上确实更改了我的应用程序崩溃的第一个响应者

我有可编辑的tableview单元格,当我从表格中的第一个文本字段移动到最后一个文本字段时,它正在崩溃.代码是.下面的代码用于textfield委托

-(void)textFieldDidBeginEditing:(UITextField *)sender
{
   NSIndexPath *indexpath = [NSIndexPath indexPathForRow:sender.tag inSection:1];
    EditableTextFieldCell *cell = (EditableTextFieldCell *)[self.documentdetailTable cellForRowAtIndexPath:indexpath];
    self.actField = cell.textFieldOne;
    if([self.actField canBecomeFirstResponder]){
        [self.actField becomeFirstResponder];
    }
}
 -(BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
   if (self.actField == textField) {
      [self.actField resignFirstResponder];
    }
    return YES;
}
-(void)textFieldDidEndEditing:(UITextField*)sender
{
if (self.quantityValue !=nil)
        {
            [self.quantityArray replaceObjectAtIndex:[sender tag] withObject:sender.text];
            [[self.documentItemsArray objectAtIndex:[sender tag]] setQUANTITY:[NSNumber numberWithDouble:[sender.text doubleValue]]];
            [self.documentdetailTable reloadData];
        }
}
- (BOOL)textFieldShouldClear:(UITextField *)textField {
self.quantityValue=@"";
return YES;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    return YES;
}
-(void)textFieldDidChange:(UITextField *)theTextField
{
    NSLog( …
Run Code Online (Sandbox Code Playgroud)

objective-c textfield ios7

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

格式化轴标签核心图的长数字

我正在尝试为我的轴标签格式化"k"形式的长数字.例如; 如果我有10000,我希望它显示为10k.

我已经尝试过这个答案.但我无法获得格式化的数字.我还需要做什么?请指导我.谢谢.

编辑:

HumanReadableFormatter.h

@interface HumanReadableFormatter : NSNumberFormatter

@end
Run Code Online (Sandbox Code Playgroud)

HumanReadableFormatter.m

我修改了上面链接中的代码以满足我的要求.

#import "HumanReadableFormatter.h"

@implementation HumanReadableFormatter

static const char sUnits[] = { '\0', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y' };
static int sMaxUnits = sizeof sUnits - 1;

    -(NSString *) stringForObjectValue:(id)obj
{
    int multiplier =  1000;
    int exponent = 0;

    double bytes = [(NSNumber *)obj doubleValue];

    while ((bytes >= multiplier) && (exponent < sMaxUnits)) {
        bytes /= multiplier;
        exponent++;
    }
    return [NSString …
Run Code Online (Sandbox Code Playgroud)

core-plot nsnumberformatter ios

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

如何使用UIBezierPath绘制一条弧线

我想画出如图所示的形状.背景是白色的..希望它对你来说是可见的..

在此输入图像描述

我正在使用bezier路径来绘制这个.我提供了如蓝色边框所示的边界形状.

在此输入图像描述

到目前为止,我成功地只绘制了两条线(以绿色显示).我必须进一步用红色画一个.

在此输入图像描述

我无法从这一点画出弧线.我无法理解如何将正确的参数传递给addArcWithCenter.

-(void) drawRect:(CGRect)rect
{
    //declare and instantiate the UIBezierPath object
    aPath = [UIBezierPath bezierPath];

    // Set the starting point of the shape.
    [aPath moveToPoint:CGPointMake(CGRectGetMinX(rect), CGRectGetMinY(rect))];

    // Draw some lines.
    [aPath addLineToPoint:CGPointMake(CGRectGetMaxX(rect), CGRectGetMinY(rect))];
    [aPath addLineToPoint:CGPointMake(CGRectGetMaxX(rect), CGRectGetMaxY(rect) - 40)];
    [aPath addArcWithCenter:self.center radius:40 startAngle:3 *(M_PI / 2) endAngle:M_PI clockwise:NO];

    //set the line width
    aPath.lineWidth = 2;

    //set the stoke color
    [[UIColor greenColor] setStroke];

    //draw the path
    [aPath stroke];

}
Run Code Online (Sandbox Code Playgroud)

我是核心图形新手.请对我宽容..谢谢..

core-graphics ios uibezierpath

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