通过 ConstraintLayout,我使用 BottomSheet 来显示地图详细信息的内容。我的想法与 GoogleMaps 中使用的相同,但顶部没有图像轮播。
我需要找到一些属性将BottomSheet绑定在底部,仅使用其布局的大小,而不是整个窗口,如下所示:
这是父视图中我的 XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:mapbox="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.mapbox.mapboxsdk.maps.MapView
android:id="@+id/mapview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
mapbox:center_latitude="0"
mapbox:center_longitude="0"
mapbox:style_url="@string/style_mapbox_streets"
mapbox:zoom="12" />
<!--
<ImageView
android:id="@+id/bottom_sheet_backdrop"
android:layout_width="match_parent"
android:layout_height="@dimen/anchor_point"
android:fitsSystemWindows="true"
app:layout_behavior="@string/BackDropBottomSheetBehavior" />
-->
<android.support.v4.widget.NestedScrollView
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
app:anchorPoint="@dimen/anchor_point"
app:behavior_hideable="true"
app:behavior_peekHeight="@dimen/bottom_sheet_peek_height"
app:layout_behavior="@string/BottomSheetBehaviorGoogleMapsLike">
<include
layout="@layout/places_bottom_sheet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true" />
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/places_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/fab_margin"
android:clickable="true"
android:src="@drawable/ic_directions"
app:elevation="3dp"
app:layout_anchor="@id/bottom_sheet"
app:layout_anchorGravity="top|right|end"
app:layout_behavior="@string/ScrollAwareFABBehavior" />
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
这是来自BottomSheet“layout/places_bottom_sheet”的设计
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical"
android:paddingBottom="16dp">
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="0dp" …Run Code Online (Sandbox Code Playgroud) 我在为项目添加可达性方面遇到了一些问题.我之前只是使用过Reachability,但这次我失败了.我总是有以下错误:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_Reachability", referenced from:
objc-class-ref in DelegatePrincipal.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
我的项目不使用ARC(我不想要它),基础sdk 5.0,ARchitecture标准(armv7),我已经添加了SystemConfiguration.framework.
我还测试了Tony百万可达性,它不起作用.同样的问题.
我从其他主题中看到了同样的问题,但它与ARC有关.我的项目没有ARC.
另外,我在委托中进行了一个简单的测试,如下所示:
Reachability *reach = [Reachability reachabilityForInternetConnection];
NetworkStatus netStatus = [reach currentReachabilityStatus];
if (!netStatus == NotReachable) {
NSLog(@"Not connected");
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
UIViewController我想在每次显示a 时显示整页图像广告。viewDidAppear我想我必须调用or内的方法ViewWillAppear,但它们被调用一次。
- (void) viewDidAppear:(BOOL)animated{
[self showAds];
}
- (void) showAds{
//Do Something
}
Run Code Online (Sandbox Code Playgroud)
每次显示 uiviewcontroller 时我应该如何调用方法(即使它已经创建)?
我正在尝试制作一个具有“动态屏幕高度”的 UIWebView。该 webview 位于 UIScrollView 内部,位于其他组件下方。查看布局(它使用自动布局):
我的想法是只提供一个滚动(来自 UIScrollView - 它的工作)并使WebView 视口根据内容大小而增长。而且它不起作用。
我做了什么来尝试做到这一点:
在我的 UIViewController 中:
- (void) viewDidAppear:(BOOL)animated {
NSString *urlString = @"MY URL GOES HERE";
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
[_webViewDescription loadRequest:urlRequest];
_webViewDescription.delegate = self;
_webViewDescription.scrollView.scrollEnabled = NO;
_webViewDescription.scrollView.bounces = NO;
}
Run Code Online (Sandbox Code Playgroud)
我的 UIWebViewDelegate:
- (void)webViewDidFinishLoad:(UIWebView *)webView {
CGRect frame = webView.frame;
frame.size.height = 1;
webView.frame = frame;
CGSize fittingSize = [webView sizeThatFits:CGSizeZero];
frame.size = fittingSize; …Run Code Online (Sandbox Code Playgroud) 我正在使用 Android GoogleMap 类(Google Play Services 8.1.0),想要跟踪地图位置变化,这可以通过在屏幕内平移或缩放来实现。
随着活动的进行,我需要根据地图中心更新地点。
在以前的API中是可以的,但是现在我没有找到方法来做到这一点。
我是一名Java开发人员.当我需要在课堂上提供参考资料时,我这样做:
public class Account{
private int num;
private Person client;
}
Run Code Online (Sandbox Code Playgroud)
但现在,我必须在C++中做同样的事情
我怎么能在.h文件中这样做?
其实我只有num属性:
class Account{
private:
int num;
public:
Account(int num);
~Account();
int getNum();
void setNum(int num);
}
Run Code Online (Sandbox Code Playgroud)
我应该如何将Person属性放在下面,我应该如何编译它?谢谢.
ios ×3
android ×2
iphone ×2
objective-c ×2
attributes ×1
bottom-sheet ×1
c++ ×1
ipad ×1
maps ×1
oop ×1
reachability ×1
uiscrollview ×1
uiview ×1
uiwebview ×1
xcode ×1