小编Des*_*ond的帖子

静态UILabel未在uiview中显示

我在Interface Builder中创建了一些静态UILabel文本,但在运行应用程序时.标签没有显示在应用程序本身,我不知道为什么.

所有其他东西,如textfield,按钮除了标签不起作用,任何人都可以告诉我出了什么问题?

这是在IB

在此输入图像描述

这是在App

在此输入图像描述

在此输入图像描述

#import "SettingsViewController.h"

@implementation SettingsViewController

@synthesize drinkLimitText;

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {

    appDelegate = (DrinkTabsAndNavAppDelegate *)[[UIApplication sharedApplication] delegate];
    [super viewDidLoad];

    NSLog(@"subView:%d",[self.view.subviews count]);
}


- (void) viewWillAppear:(BOOL)animated {


    if ([appDelegate.drinkLimit floatValue] >= 0) 
        drinkLimitText.text = [NSString stringWithFormat:@"%.0f", [appDelegate.drinkLimit floatValue]];
    else 
        drinkLimitText.text = @"0";

    [super viewWillAppear:animated];
}

- (IBAction)textFieldDoneEditing:(id)sender{ 
    NSDecimalNumber *tempValue = [[NSDecimalNumber alloc] initWithString:drinkLimitText.text];
    if (tempValue == [NSDecimalNumber notANumber] || [tempValue doubleValue] < 0) …
Run Code Online (Sandbox Code Playgroud)

iphone xcode interface-builder uilabel

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

Swift Mapkit 最大最小缩放

我似乎无法找到我的问题的最佳答案。

我有这个“OK”但不知道的代码

func mapView(_ mapView: MKMapView, regionDidChangeAnimated animated: Bool) {

        print(mapView.camera.altitude)
        if mapView.camera.altitude < 800.00 && !modifyingMap
        {
            modifyingMap = true
            mapView.camera.altitude = 800.00
            modifyingMap = false
        }
    }
Run Code Online (Sandbox Code Playgroud)

我想在我的应用程序中将用户的最大和最小缩放限制到我的地图。

非常感谢任何指向 SO 答案的链接!

谢谢!

uiscrollview mapkit ios swift

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

如何在应用更新下载后再次调用didFinishLaunchingWithOptions

我想知道如何在应用程序更新下载后再次调用didFinishLaunchingWithOptions,因为我的所有函数调用都在那里.

self.dataArray = [self readDataJsonFromDocument];当我从网上下载数据时,我需要再次调用它.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{   


    [self   UIAppearances];    

    //first load
    [self copyJsonFromBundle];

    [self copyFolderFromBundle];

    self.dataArray = [self readDataJsonFromDocument]; //i need to call this again

    // Override point for customization after application launch.
    // Add the tab bar controller's current view as a subview of the window


    self.window.rootViewController = self.tabBarController;
    [self.window makeKeyAndVisible];

    return YES;
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {



    //NSString *downloadFolder = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"download"];

    //save to a temp file
    NSString* filePath = …
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch objective-c ios

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

如何在CGContext中旋转NSString drawinrect

如何将NSString旋转到一定程度?当我与图像一起画一个字符串.

我提到这个问题用NSString drawInRect绘制旋转文本,但我的Ellipse消失了.

//Add text to UIImage
-(UIImage *)addMoodFound:(int)moodFoundCount andMoodColor:(CGColorRef)mColour
{
    float scaleFactor = [[UIScreen mainScreen] scale];
    UIGraphicsBeginImageContextWithOptions(CGSizeMake(36, 36), NO,scaleFactor);

    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSaveGState(context);

    //CGContextSetRGBFillColor(context, kCGAggressiveColor);
    CGContextSetFillColorWithColor(context,mColour);
    CGContextFillEllipseInRect(context, CGRectMake(0, 0, 36, 36));
    CGContextSetRGBFillColor(context, 250, 250, 250, 1);

//nsstring missing after adding this 3 line
 CGAffineTransform transform1 = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(65));
    CGContextConcatCTM(context, transform1);
    CGContextTranslateCTM(context, 36, 0);
Run Code Online (Sandbox Code Playgroud)

////////////////////////////////////////////////

    [[NSString stringWithFormat:@"%d",moodFoundCount ] drawInRect : CGRectMake(0, 7, 36, 18)
             withFont : [UIFont fontWithName:monR size:17]
        lineBreakMode : NSLineBreakByTruncatingTail
            alignment : NSTextAlignmentCenter ];

    CGContextRestoreGState(context);

    UIImage …
Run Code Online (Sandbox Code Playgroud)

objective-c nsstring cgaffinetransform ios

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