我正在尝试用状态按下并选择一个按钮,我已经对标签做了同样的工作,但我不知道为什么这里不起作用.我这样做了:
button_sel.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="@color/azulado"
android:endColor="@color/azulBrillante"
android:angle="270" />
<corners android:radius="@dimen/corner_radius" />
<stroke android:width="2px"
android:color="@color/blanco" />
</shape>
Run Code Online (Sandbox Code Playgroud)
button_unsel.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="@color/botonesD"
android:endColor="@color/botones"
android:angle="270" />
<corners android:radius="@dimen/corner_radius" />
<stroke android:width="2px"
android:color="@color/blanco" />
</shape>
Run Code Online (Sandbox Code Playgroud)
和选择器,button.xml:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/button_sel"
android:state_selected="true"
android:state_pressed="true"/>
<item android:drawable="@drawable/button_unsel"
android:state_selected="false"
android:state_pressed="false"/>
</selector>
Run Code Online (Sandbox Code Playgroud)
在这里我将drawable称为背景:
<style name="button">
<item name="android:background">@drawable/button</item>
<item name="android:textSize">@dimen/text_size</item>
<item name="android:padding">@dimen/padding_button</item>
<item name="android:textColor">@color/blanco</item>
</style>
Run Code Online (Sandbox Code Playgroud)
谢谢!!!!
我今天更新了cocoapods到1.0.0版本.我更新pod时得到了这个字符串:
[!] Invalid Podfile file: [!] The specification of link_with in the Podfile is now unsupported, please use target blocks instead..
我已经删除了podFile中的link_with,但我无法构建项目,因为我有很多Match-O-Linkers.任何人都知道我应该如何解决这个问题?
这是我的Podfile现在:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
inhibit_all_warnings!
pod 'pop', '~> 1.0'
pod 'AFNetworking', '~> 1.3'
pod 'SDWebImage', '~> 3.7'
pod 'GoogleAnalytics', '~> 3'
pod 'ARAnalytics' , :subspecs => ["Crashlytics", "Amplitude", "DSL"]
pod 'FBSDKCoreKit', '~> 4.10.1'
pod 'FBSDKLoginKit', '~> 4.10.1'
pod 'FBSDKShareKit', '~> 4.10.1'
pod 'Google/SignIn'
pod 'Branch'
pod 'Leanplum-iOS-SDK'
pod 'Fabric', '1.6.7'
pod 'Crashlytics', '3.7.0'
pod 'TwitterKit'
pod …
Run Code Online (Sandbox Code Playgroud) 我正在尝试开始使用MVVM
withObjective-c
但我遇到了一些问题CoreData
。我不知道该由谁来处理这些fetchedResultsControllerDelegate
方法。该viewModel
还是viewController
?
我认为 viewModel 应该处理它,但我看到太多的代码来做同样的事情。
我正在使用Google plus Framework
我的应用程序,但是response
当我从Google-Plu
s应用程序返回时,我无法得到它.我添加了URL-Scheme
,我在控制台和应用程序中有相同的包.我也有正确的CLIENTID
.任何人都有同样的问题?
可能是问题发生在iOS 8
或Xcode 6
??
现在,我收到此错误:
Error Domain=com.google.GooglePlusPlatform Code=-1 "keychain error" UserInfo=0x175263ec0 {NSLocalizedDescription=keychain error}
Run Code Online (Sandbox Code Playgroud)
谢谢
我创建了一个TabBarController
包含三个ViewControllers
内部的应用程序UINavigationControllers
,A,B和C.我已经以编程方式创建了所有内容.现在我想在其中一个TabBar项目中推送一些ViewControllers.
例如,如果我在ViewController B中,我按下一个按钮,我想将一个pushViewController转换为ViewController:D,如果我按下DI中的新按钮想要转到一个新的ViewController E.并且每当我想要的时候我应该可以回到NavigationController后退按钮.
问题是当我尝试从D回到B时,我在D和B之间有一个新的空ViewController,我得到这个错误:
首先,我在B并按下NEXT按钮到D:
2013-10-30 01:00:07.076 Wplanet[11964:70b] nested push animation can result in corrupted navigation bar
2013-10-30 01:00:07.444 Wplanet[11964:70b] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-10-30 01:00:07.582 Wplanet[11964:70b] Unbalanced calls to begin/end appearance transitions for <DViewController: 0x8aa7260>.
Run Code Online (Sandbox Code Playgroud)
这里的应用程序不会崩溃.
第二,我在D,我想回到B(通过导航栏中的backButton):
我第一次按下后退按钮会出现一个空的viewController,在导航栏中有新的后退按钮(在D和B之间).然后我按下新的BackButton并且app崩溃并出现此错误:
2013-10-30 01:03:54.790 Wplanet[12001:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't add self as subview'
*** First throw call stack: …
Run Code Online (Sandbox Code Playgroud) iphone objective-c uitabbarcontroller uinavigationcontroller ios
我需要使布局背景闪烁或闪烁,每秒都会改变.我写了这段代码:
int colours[]={0xff00ff00, 0xffff0000, 0xff0000ff,0xffffffff};
RelativeLayout fondo;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
fondo = (RelativeLayout) findViewById(R.id.fondo);
this.fondo.setBackgroundColor(colours[0]);
this.fondo.setOnTouchListener(this);
}
Run Code Online (Sandbox Code Playgroud)
这是onTouch方法:
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_UP) {
int i=1;
long delay= 1000;
long time = System.currentTimeMillis();
while(true) {
long time2 = System.currentTimeMillis();
long time3 = (time2 - time);
if (time3 > delay) {
this.fondo.setBackgroundColor(colours[i]);
Log.d("DEBUG", "EEEEEEEEEEEEEEEEEEEEEEEEEEEEE");
time = System.currentTimeMillis();
i++;
if (i >= colores.length)
i=0;
}
}
}
return true;
}
Run Code Online (Sandbox Code Playgroud)
我的问题是我无法每秒更改背景颜色,但我可以每秒编写Log.d("DEBUG").
我正在开发一个应用程序,当它开始执行时,它必须从webService获取一些数据,类别,加载图像(有时会更改),信息"如何使用"(也可以在服务器中更改,客户端规范.. ).为了获得这些数据,我调用了一些像这样的方法(我有四个类似的方法,每个我需要的一个方法):
-(void) loadAppInfo
{
__weak typeof(self) weakSelf = self;
completionBlock = ^(BOOL error, NSError* aError) {
if (error) {
// Lo que sea si falla..
}
[weakSelf.view hideToastActivity];
};
[self.view makeToastActivity];
[wpNetManager getApplicationInfoWithCompletionBlock:completionBlock];
}
Run Code Online (Sandbox Code Playgroud)
在我的网络管理器中,我有类似这样的方法:
- (void)getApplicationInfoWithCompletionBlock:(CompletionBlock)completionBlock
{
NSString * lang = @"es";//[[NSLocale preferredLanguages] objectAtIndex:0];
NSString *urlWithString = [kAPIInfoScreens stringByAppendingString:lang];
NSMutableURLRequest *request = nil;
request = [self requestWithMethod:@"GET" path:urlWithString parameters:nil];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[self registerHTTPOperationClass:[AFHTTPRequestOperation class]];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
// Print the response …
Run Code Online (Sandbox Code Playgroud) objective-c nsoperationqueue grand-central-dispatch ios objective-c-blocks
ios ×4
objective-c ×4
android ×2
iphone ×2
background ×1
button ×1
cocoapods ×1
google-plus ×1
layout ×1
mvvm ×1
styles ×1
xcode ×1
xml-drawable ×1