我想为iPhone X调整我的本机应用程序。我尝试使用SafeAreaView,但这在顶部和底部区域都增加了空间。问题是我底部不需要空间。我厌倦了为应用添加填充
class CatalogController extends Controller
{
/**
* @param Request $request
* @return View
*/
public function getAllAction(Request $request)
{
$name = $request->query->get('name');
$result = $this->getDoctrine()->getRepository('AppBundle:Category')->findBy(array('name' => $name));
if ($result === NULL) {
return new View("Catalog not found", Response::HTTP_NOT_FOUND);
}
return new View($result,Response::HTTP_OK);
}
/**
* @param $id
* @return View|object
*/
public function getAction($id)
{
$result = $this->getDoctrine()->getRepository('AppBundle:Category')->find($id);
if (!$result instanceof Category) {
return new View("ID: " . $id . " not found", Response::HTTP_NOT_FOUND);
}
return new View($result, Response::HTTP_OK);
}
/**
* @param Request $request
* @return View|Response
*/
public function postAction(Request $request)
{
$serializer = $this->get('jms_serializer');
$content = $request->getContent();
$category = $serializer->deserialize($content,'AppBundle\Entity\Category','json');
$errors = $this->get('validator')->validate($category);
if (count($errors) > 0) {
return new View("NAME LENGTH MUST BE >4",Response::HTTP_BAD_REQUEST);
} else {
$em = $this->getDoctrine()->getManager();
$em->persist($category);
$em->flush();
return new View($category, Response::HTTP_OK);
}}}
这看起来很不错但在这种情况下我无法更改空白区域的颜色。还有其他解决方案吗?